public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Kay Sievers <kay.sievers@vrfy.org>
Cc: Greg KH <greg@kroah.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix kobject uevent string handling errors
Date: Sat, 25 Aug 2007 14:38:34 -0400	[thread overview]
Message-ID: <20070825183833.GA2000@Krystal> (raw)
In-Reply-To: <1188051937.2493.21.camel@lov.localdomain>

* Kay Sievers (kay.sievers@vrfy.org) wrote:
 >  	env->envp[env->envp_idx++] = &env->buf[env->buflen];
> >  	env->buflen += len + 1;
> > Index: linux-2.6-lttng/drivers/firmware/dmi-id.c
> > ===================================================================
> > --- linux-2.6-lttng.orig/drivers/firmware/dmi-id.c	2007-08-25 00:07:24.000000000 -0400
> > +++ linux-2.6-lttng/drivers/firmware/dmi-id.c	2007-08-25 00:07:58.000000000 -0400
> > @@ -152,9 +152,10 @@ static int dmi_dev_uevent(struct device 
> >  	if (add_uevent_var(env, "MODALIAS="))
> >  		return -ENOMEM;
> >  	len = get_modalias(&env->buf[env->buflen - 1],
> > -			   sizeof(env->buf) - env->buflen);
> > -	if (len >= (sizeof(env->buf) - env->buflen))
> > +			   sizeof(env->buf) - (env->buflen - 1));
> > +	if (len >= (sizeof(env->buf) - (env->buflen - 1)))
> >  		return -ENOMEM;
> > +	env->buflen += len + 1;
> 
> The increment for the trailing '\0' is already done in add_uevent_var(),
> so this change is not needed, I think.

Oh, you are right, since we replace the existing \0 which is already
accounted for, we don't have to do len +1 here.

Thanks,

Mathieu


-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

  reply	other threads:[~2007-08-25 18:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-24 22:47 kernel BUG with 2.6.23-rc3-mm1: skb_over_panic Mathieu Desnoyers
2007-08-24 23:10 ` Andrew Morton
2007-08-24 23:46   ` Greg KH
2007-08-25  0:16   ` Mathieu Desnoyers
2007-08-25  0:44     ` Andrew Morton
2007-08-25  0:46       ` Greg KH
2007-08-25  1:26         ` Kay Sievers
2007-08-25  3:02         ` Mathieu Desnoyers
2007-08-25  3:44           ` Kay Sievers
2007-08-25  3:52             ` Mathieu Desnoyers
2007-08-25  3:56             ` Mathieu Desnoyers
2007-08-25  3:58             ` Daniel Walker
2007-08-25  4:17         ` [PATCH] Fix kobject uevent string handling errors Mathieu Desnoyers
2007-08-25  4:49           ` Greg KH
2007-08-25 14:25           ` Kay Sievers
2007-08-25 18:38             ` Mathieu Desnoyers [this message]
2007-08-25  1:59       ` kernel BUG with 2.6.23-rc3-mm1: skb_over_panic Randy Dunlap

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=20070825183833.GA2000@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=akpm@linux-foundation.org \
    --cc=greg@kroah.com \
    --cc=kay.sievers@vrfy.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