From: Bjorn Helgaas <bjorn_helgaas@hp.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] SAL error record logging/decoding
Date: Thu, 29 May 2003 01:34:01 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590723706063@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590723705660@msgid-missing>
On Wednesday 28 May 2003 6:07 pm, Keith Owens wrote:
> >+#define CPUSTR "cpu%d"
> >+ char name[sizeof(CPUSTR)];
>
> Too small. name[] will overflow at cpu 100.
Thanks. I remember thinking about that when I copied the code,
but forgot to fix it. How about something like this:
--- 1.12/arch/ia64/kernel/palinfo.c Mon Apr 21 04:52:56 2003
+++ edited/arch/ia64/kernel/palinfo.c Wed May 28 19:02:32 2003
@@ -914,7 +914,7 @@
struct proc_dir_entry **pdir = palinfo_proc_entries;
struct proc_dir_entry *palinfo_dir, *cpu_dir;
int i, j;
- char cpustr[sizeof(CPUSTR)];
+ char cpustr[sizeof(CPUSTR) + 2];
printk(KERN_INFO "PAL Information Facility v%s\n", PALINFO_VERSION);
@@ -928,7 +928,7 @@
if (!cpu_online(i)) continue;
- sprintf(cpustr,CPUSTR, i);
+ snprintf(cpustr, sizeof(cpustr), CPUSTR, i);
cpu_dir = proc_mkdir(cpustr, palinfo_dir);
--- arch/ia64/kernel/salinfo.c.orig 2003-05-28 19:03:04.000000000 -0600
+++ arch/ia64/kernel/salinfo.c 2003-05-28 19:03:21.000000000 -0600
@@ -233,7 +233,7 @@
struct proc_dir_entry *cpu_dir, *entry;
struct salinfo_wait_queue *wait;
#define CPUSTR "cpu%d"
- char name[sizeof(CPUSTR)];
+ char name[sizeof(CPUSTR) + 2];
int i, j;
salinfo_dir = proc_mkdir("sal", NULL);
@@ -250,7 +250,7 @@
if (!cpu_online(i))
continue;
- sprintf(name, CPUSTR, i);
+ snprintf(name, sizeof(name), CPUSTR, i);
cpu_dir = proc_mkdir(name, salinfo_dir);
if (!cpu_dir)
continue;
next prev parent reply other threads:[~2003-05-29 1:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-07 23:41 [Linux-ia64] SAL error record logging/decoding Bjorn Helgaas
2003-05-08 0:05 ` David Mosberger
2003-05-08 0:13 ` Luck, Tony
2003-05-08 19:32 ` Bjorn Helgaas
2003-05-20 22:58 ` Bjorn Helgaas
2003-05-21 18:06 ` Luck, Tony
2003-05-21 20:48 ` Luck, Tony
2003-05-21 21:51 ` Luck, Tony
2003-05-22 21:29 ` Bjorn Helgaas
2003-05-23 0:24 ` Bjorn Helgaas
2003-05-23 15:42 ` Luck, Tony
2003-05-28 23:26 ` Bjorn Helgaas
2003-05-29 0:07 ` Keith Owens
2003-05-29 1:34 ` Bjorn Helgaas [this message]
2003-05-29 1:37 ` Keith Owens
2003-05-29 20:49 ` Luck, Tony
2003-05-29 21:31 ` Bjorn Helgaas
2003-05-29 21:47 ` Luck, Tony
2003-05-29 22:38 ` Bjorn Helgaas
2003-05-29 23:33 ` Luck, Tony
2003-05-30 11:56 ` Matthew Wilcox
2003-05-30 20:27 ` Bjorn Helgaas
2003-05-30 20:31 ` Bjorn Helgaas
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=marc-linux-ia64-105590723706063@msgid-missing \
--to=bjorn_helgaas@hp.com \
--cc=linux-ia64@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.