public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: "Jean-François Dagenais" <jeff.dagenais@gmail.com>
Cc: Dan Carpenter <error27@gmail.com>,
	Evgeniy Polyakov <johnpol@2ka.mipt.ru>,
	Andrew Morton <akpm@linux-foundation.org>,
	open list <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] w1: off by one in w1_f29_remove_slave()
Date: Sat, 30 Jul 2011 08:42:29 +0000	[thread overview]
Message-ID: <4E33C3F5.9000602@bfs.de> (raw)
In-Reply-To: <9C2475AA-829E-4BB8-A3D2-2444803A33D3@gmail.com>



Am 29.07.2011 22:28, schrieb Jean-François Dagenais:
> Yup, confirmed, weird that I did not notice a crash, probably lucky shot in the environment I was using it.
> 
> On 2011-07-27, at 05:55, Dan Carpenter wrote:
> 
>> This reads past the end of the w1_f29_sysfs_bin_files[] array.  I
>> don't have this hardware, but I assume it crashes every time the
>> function is called.
>>
>> Signed-off-by: Dan Carpenter <error27@gmail.com>
> Acked-by: Jean-François Dagenais <dagenaisj@sonatest.com>
>>
>> diff --git a/drivers/w1/slaves/w1_ds2408.c b/drivers/w1/slaves/w1_ds2408.c
>> index c377818..0da4e97 100644
>> --- a/drivers/w1/slaves/w1_ds2408.c
>> +++ b/drivers/w1/slaves/w1_ds2408.c
>> @@ -373,7 +373,7 @@ static int w1_f29_add_slave(struct w1_slave *sl)
>> static void w1_f29_remove_slave(struct w1_slave *sl)
>> {
>> 	int i;
>> -	for (i = NB_SYSFS_BIN_FILES; i <= 0; --i)
>> +	for (i = NB_SYSFS_BIN_FILES - 1; i <= 0; --i)
>> 		sysfs_remove_bin_file(&sl->dev.kobj,
>> 			&(w1_f29_sysfs_bin_files[i]));
>> }


Is there any reason to release the data "backwards" ?
The default way is to go upwards. that looks more readable.

for (i=0; i < NB_SYSFS_BIN_FILES ; i++)
  sysfs_remove_bin_file(&sl->dev.kobj, w1_f29_sysfs_bin_files+i);

re,
 wh
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2011-07-30  8:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-27  9:55 [patch] w1: off by one in w1_f29_remove_slave() Dan Carpenter
2011-07-29 20:28 ` Jean-François Dagenais
     [not found]   ` <CAOmT4fS1OqQb5KOOeFnGHt1tnYGBRutVrAZ4cXB6n=hou5fn8w@mail.gmail.com>
2011-07-29 22:55     ` Dan Carpenter
2011-07-30  8:19     ` [patch v2] w1: fix for loop " Dan Carpenter
2011-08-17 18:45       ` Jean-Francois Dagenais
2011-07-30  8:42   ` walter harms [this message]
2011-07-30  8:51     ` [patch] w1: off by one " Dan Carpenter
2011-08-17 18:42       ` Jean-Francois Dagenais

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=4E33C3F5.9000602@bfs.de \
    --to=wharms@bfs.de \
    --cc=akpm@linux-foundation.org \
    --cc=error27@gmail.com \
    --cc=jeff.dagenais@gmail.com \
    --cc=johnpol@2ka.mipt.ru \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@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