[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20070825183833.GA2000@Krystal>
Date: Sat, 25 Aug 2007 14:38:34 -0400
From: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
To: Kay Sievers <kay.sievers@...y.org>
Cc: Greg KH <greg@...ah.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Fix kobject uevent string handling errors
* Kay Sievers (kay.sievers@...y.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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists