lkml.org 
[lkml]   [2007]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Fix kobject uevent string handling errors
* 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-08-25 20:41    [W:1.585 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site