lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 11 Oct 2007 09:01:03 -0700
From:	Randy Dunlap <randy.dunlap@...cle.com>
To:	"Vegard Nossum" <vegard.nossum@...il.com>
Cc:	trivial@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] init: Fix printk format strings

On Thu, 11 Oct 2007 17:55:16 +0200 Vegard Nossum wrote:

> On 10/11/07, Randy Dunlap <randy.dunlap@...cle.com> wrote:
> > On Thu, 11 Oct 2007 08:17:02 +0200 Vegard Nossum wrote:
> >
> > > This makes sure printk format strings are string literals containing no
> > > more than a single line.
> >
> > Each patch needs justification (unless it is blatantly obvious).
> >
> >
> > > Signed-off-by: Vegard Nossum <vegard.nossum@...il.com>
> > > ---
> > >  init/calibrate.c        |    4 +++-
> > >  init/do_mounts_initrd.c |    5 ++++-
> > >  init/main.c             |    2 +-
> > >  3 files changed, 8 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c
> > > index fd4fc12..ad6174c 100644
> > > --- a/init/do_mounts_initrd.c
> > > +++ b/init/do_mounts_initrd.c
> > > @@ -98,7 +98,10 @@ static void __init handle_initrd(void)
> > >                       error = sys_ioctl(fd, BLKFLSBUF, 0);
> > >                       sys_close(fd);
> > >               }
> > > -             printk(!error ? "okay\n" : "failed\n");
> > > +             if(error)
> > > +                     printk("failed\n");
> > > +             else
> > > +                     printk("okay\n");
> > >       }
> > >  }
> >
> > Why this one?
> > and if it must change, use:
> >                 if (error)
> > but I see little need for the change.
> 
> Oops about the space. And it's to make the format string a constant
> literal. If it isn't, you are going to run into trouble with options
> to remove printks at compile-time based on log-level token. I realize
> it's not really an issue at this point in time, but I assume that it
> will eventually make its way into the kernel in some way or another.

so would this be OK?

		printk("%s\n", error ? "failed" : "okay");


---
~Randy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists