public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: James Bottomley <jbottomley@parallels.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"hare@suse.de" <hare@suse.de>,
	"kbuild-all@01.org" <kbuild-all@01.org>,
	"fengguang.wu@intel.com" <fengguang.wu@intel.com>
Subject: Re: [linux-devel:devel-lkp-ib03-powerpc-201501140043 30/31] drivers/scsi/scsi_logging.c:254:3: error: format not a string literal and no format arguments
Date: Wed, 14 Jan 2015 01:40:43 -0800	[thread overview]
Message-ID: <20150114094043.GA21820@infradead.org> (raw)
In-Reply-To: <1421170252.2076.9.camel@parallels.com>

On Tue, Jan 13, 2015 at 05:30:20PM +0000, James Bottomley wrote:
> Just for everyone's sake the problem is printk format strings (and all
> the things that indirect there, like pr_xxx and dev_printk).  We must
> never pass a mutable string directly to printk because of the mayhem
> that would result if its contents were altered by the user (because some
> of the things we do in string format parsing are very dangerous), making
> this a potential security issue.  Only ever pass static strings (in the
> ro section) to printk formats.
> 
> So this is wrong:
> 
> dev_printk(KERN_INFO, dev, logbuf);
> 
> This is correct:
> 
> dev_printk(KERN_INFO, dev, "%s", logbuf);

In this case the logbug comes from actually doing just that string
formatting earlier in the function, so it practice it's harmles.
It would be useful to have a dev_puts to avoid that reinterpretation again,
though.

  reply	other threads:[~2015-01-14  9:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201501140133.IhMp3BqI%fengguang.wu@intel.com>
2015-01-13 17:30 ` [linux-devel:devel-lkp-ib03-powerpc-201501140043 30/31] drivers/scsi/scsi_logging.c:254:3: error: format not a string literal and no format arguments James Bottomley
2015-01-14  9:40   ` Christoph Hellwig [this message]
2015-01-14 15:26     ` James Bottomley

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=20150114094043.GA21820@infradead.org \
    --to=hch@infradead.org \
    --cc=fengguang.wu@intel.com \
    --cc=hare@suse.de \
    --cc=jbottomley@parallels.com \
    --cc=kbuild-all@01.org \
    --cc=linux-scsi@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