public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dick Streefland <dick.streefland@altium.nl>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] /proc/cmdline broken since 2.4.19
Date: Mon, 20 Jan 2003 18:45:10 +0100	[thread overview]
Message-ID: <20030120174510.GA12451@altium.nl> (raw)

Reading /proc/cmdline one character at a time produces garbage since
kernel version 2.4.19:

$ cat /proc/cmdline
auto BOOT_IMAGE=2.4.20-x78 ro root=302 nomodules
$ dd bs=1 if=/proc/cmdline | od -x
49+0 records in
49+0 records out
0000000 0200 5555 0006 0000 622d 7361 0068 5555
0000020 5555 cfcf cfcf cfcf 5555 5555 0000 0000
0000040 02f7 5555 000b 0000 6c6e 4e5f 404c 7565
0000060 0072
0000061

The following patch fixes this:

--- linux-2.4.20/fs/proc/proc_misc.c.orig	Wed Dec  4 11:01:33 2002
+++ linux-2.4.20/fs/proc/proc_misc.c	Mon Jan 20 18:33:02 2003
@@ -422,9 +422,9 @@
 				 int count, int *eof, void *data)
 {
 	extern char saved_command_line[];
-	int len;
+	int len = 0;
 
-	len = snprintf(page, count, "%s\n", saved_command_line);
+	proc_sprintf(page, &off, &len, "%s\n", saved_command_line);
 	return proc_calc_metrics(page, start, off, count, eof, len);
 }
 

-- 
Dick Streefland                      ////                      Altium BV
dick.streefland@altium.nl           (@ @)          http://www.altium.com
--------------------------------oOO--(_)--OOo---------------------------

                 reply	other threads:[~2003-01-20 17:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20030120174510.GA12451@altium.nl \
    --to=dick.streefland@altium.nl \
    --cc=linux-kernel@vger.kernel.org \
    /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