Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1741267

Re: [PATCH] params: Fix an overflow in param_attr_show

From Jean Delvare <jdelvare@suse.de>
Newsgroups linux.kernel
Subject Re: [PATCH] params: Fix an overflow in param_attr_show
Date 2017-09-28 10:20 +0200
Message-ID <uuCd4-6xg-17@gated-at.bofh.it> (permalink)
References <uufJw-8gT-9@gated-at.bofh.it> <uufTc-8kl-19@gated-at.bofh.it> <uuh8C-B0-21@gated-at.bofh.it> <uukJb-3qZ-7@gated-at.bofh.it> <uuC3p-6tW-19@gated-at.bofh.it>
Organization SUSE Linux

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] params: Fix an overflow in param_attr_show Jean Delvare <jdelvare@suse.de> - 2017-09-27 10:20 +0200
  Re: [PATCH] params: Fix an overflow in param_attr_show Ingo Molnar <mingo@kernel.org> - 2017-09-27 10:30 +0200
    Re: [PATCH] params: Fix an overflow in param_attr_show Jean Delvare <jdelvare@suse.de> - 2017-09-27 11:50 +0200
      Re: [PATCH] params: Fix an overflow in param_attr_show Ingo Molnar <mingo@kernel.org> - 2017-09-27 15:40 +0200
        Re: [PATCH] params: Fix an overflow in param_attr_show Jean Delvare <jdelvare@suse.de> - 2017-09-28 10:10 +0200
          Re: [PATCH] params: Fix an overflow in param_attr_show Jean Delvare <jdelvare@suse.de> - 2017-09-28 10:20 +0200
            Re: [PATCH] params: Fix an overflow in param_attr_show Ingo Molnar <mingo@kernel.org> - 2017-09-28 10:40 +0200
              Re: [PATCH] params: Fix an overflow in param_attr_show Jean Delvare <jdelvare@suse.de> - 2017-09-28 18:10 +0200
          Re: [PATCH] params: Fix an overflow in param_attr_show Ingo Molnar <mingo@kernel.org> - 2017-09-28 10:50 +0200
  Re: [PATCH] params: Fix an overflow in param_attr_show Jean Delvare <jdelvare@suse.de> - 2017-09-28 11:00 +0200

csiph-web