Re: [PATCH] Fix kobject uevent string handling errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Kay Sievers ([email protected]) 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux