public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Disconnect <lkml@sigkill.net>
To: Riley@Williams.Name, davej@suse.de, hpa@zytor.com
Cc: trivial@rustcorp.com.au, lkml <linux-kernel@vger.kernel.org>
Subject: [2.4][TRIVIAL] Use of uninitialized vars in arch/i386/kernel/process.c
Date: 07 Jul 2003 12:01:42 -0400	[thread overview]
Message-ID: <1057593701.4081.87.camel@slappy> (raw)

[-- Attachment #1: Type: text/plain, Size: 1287 bytes --]

Sorry for the longish To list, not sure who's responsible for this
particular piece. (And if I got it wrong even after all that, please let
me know..)

This is for 2.4; in 2.5 reboot.c has identical code with an identical
problem. (I'll send a separate patch after getting feedback on this
one.)

If you don't pass reboot=, reboot_mode and reboot_thru_bios are used
uninitialized and (in the case of reboot_mode) written directly to
memory for the bios.

This patch sets reboot_mode to 0x1234 by default, and reboot_thru_bios
(used in "if(!reboot_thru_bios)") to 1.

void machine_restart(char * __unused)
{
..[smp shutdown]..
  if(!reboot_thru_bios) {
        /* rebooting needs to touch the page at absolute addr 0 */
        *((unsigned short *)__va(0x472)) = reboot_mode;
...
        machine_real_restart(jump_to_bios, sizeof(jump_to_bios));
}

void machine_real_restart(unsigned char *code, int length)
{
.....
  /* Write 0x1234 to absolute memory location 0x472.  The BIOS reads
     this on booting to tell it to "Bypass memory test (also warm
     boot)".  This seems like a fairly standard thing that gets set by
     REBOOT.COM programs, and the previous reset routine did this
     too. */

  *((unsigned short *)0x472) = reboot_mode;
...
}


-- 
Disconnect <lkml@sigkill.net>

[-- Attachment #2: Type: text/plain, Size: 1044 bytes --]

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1042  -> 1.1043 
#	arch/i386/kernel/process.c	1.14    -> 1.15   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/07/07	dis@slappy.(none)	1.1043
# Initialize reboot_mode to defaults (according to comments) even if reboot= is lacking.  Ditto for reboot_thru_bios. 
# (Warm boot, use bios.) 
# --------------------------------------------
#
diff -Nru a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
--- a/arch/i386/kernel/process.c	Mon Jul  7 11:42:50 2003
+++ b/arch/i386/kernel/process.c	Mon Jul  7 11:42:50 2003
@@ -152,8 +152,8 @@
 __setup("idle=", idle_setup);
 
 static long no_idt[2];
-static int reboot_mode;
-int reboot_thru_bios;
+static int reboot_mode=0x1234;
+int reboot_thru_bios=1;
 
 #ifdef CONFIG_SMP
 int reboot_smp = 0;

             reply	other threads:[~2003-07-07 15:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-07 16:01 Disconnect [this message]
2003-07-09 12:02 ` [2.4][TRIVIAL] Use of uninitialized vars in arch/i386/kernel/process.c Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1057593701.4081.87.camel@slappy \
    --to=lkml@sigkill.net \
    --cc=Riley@Williams.Name \
    --cc=davej@suse.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trivial@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox