public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: Ingo Molnar <mingo@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Baoquan He <bhe@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	"H. Peter Anvin" <hpa@zytor.com>, Borislav Petkov <bp@alien8.de>
Subject: Re: [PATCH] params: Fix an overflow in param_attr_show
Date: Thu, 28 Sep 2017 10:11:08 +0200	[thread overview]
Message-ID: <20170928101108.5a3c270b@endymion> (raw)
In-Reply-To: <20170928100223.2be62f88@endymion>

On Thu, 28 Sep 2017 10:02:23 +0200, Jean Delvare wrote:
> On Wed, 27 Sep 2017 15:31:04 +0200, Ingo Molnar wrote:
> > At minimum I'd suggest aligning the definitions vertically, to make sure
> > any missing \n stands out more, visually:
> > 
> > STANDARD_PARAM_DEF(byte,	unsigned char,		"%hhu\n",	kstrtou8);
> > STANDARD_PARAM_DEF(short,	short,			"%hi\n",	kstrtos16);
> > STANDARD_PARAM_DEF(ushort,	unsigned short,		"%hu\n",	kstrtou16);
> > STANDARD_PARAM_DEF(int,	int,			"%i\n",		kstrtoint);
> > STANDARD_PARAM_DEF(uint,	unsigned int,		"%u\n",		kstrtouint);
> > STANDARD_PARAM_DEF(long,	long,			"%li\n",	kstrtol);
> > STANDARD_PARAM_DEF(ulong,	unsigned long,		"%lu\n",	kstrtoul);
> > STANDARD_PARAM_DEF(ullong,	unsigned long long,	"%llu\n",	kstrtoull);  
> 
> Sure it is possible to add a new parameter type. But why would the
> person adding it forget the \n? I can't imagine that someone adding a
> new type would type the new line of code character by character. Such an
> operation is calling for copy, paste and edit, at which point there is
> no reason why the \n would be actively deleted. Or this is sabotage,
> really ;-)
> 
> Aligning parameters vertically as you suggest above is probably a good
> idea for overall readability anyway, so I can change my patch to do
> that, as I am modifying these lines anyway. It is pretty much
> independent from the fix per se, but if it makes you happy...

Or... I could append the \n inside the STANDARD_PARAM_DEF macro, so the
calls are unchanged. Makes my patch smaller, and addresses your concern
just as well, I suppose.

-- 
Jean Delvare
SUSE L3 Support

  reply	other threads:[~2017-09-28  8:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-27  8:10 [PATCH] params: Fix an overflow in param_attr_show Jean Delvare
2017-09-27  8:26 ` Ingo Molnar
2017-09-27  9:40   ` Jean Delvare
2017-09-27 13:31     ` Ingo Molnar
2017-09-28  8:02       ` Jean Delvare
2017-09-28  8:11         ` Jean Delvare [this message]
2017-09-28  8:38           ` Ingo Molnar
2017-09-28 13:33             ` Jean Delvare
2017-09-28  8:48         ` Ingo Molnar
2017-09-28  8:49 ` Jean Delvare

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=20170928101108.5a3c270b@endymion \
    --to=jdelvare@suse.de \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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