lkml.org 
[lkml]   [2003]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [2.4] Multiple memleaks in IBM Hot Plug Controller Driver
Hello!

On Fri, Mar 14, 2003 at 11:54:40AM +0200, Denis Vlasenko wrote:

> > + if (!str)
> > + return NULL;
> > memset (str, 0, 3);
> This was fun, right? "Lets add second memset just in case
> first failed" ;) ;)

Ah, I was half asleep when doing the change, so I missed
other obvious stuff it seems, like memset of three bytes to
two byte variabe :)
memset on wrong thing (second memset should be applied to str1 of course.)

But as Greg KH said already, whis stuff should be replaced by version from 2.5 instead ;)

> > bit = (int)(var / 10);
> > switch (bit) {
> > @@ -608,13 +608,20 @@
> > return str;
> > default:
> > //2 digits number
> > + str1 = (char *) kmalloc (2, GFP_KERNEL);
> > + if (!str1) {
> > + break;
> > + }
> > + memset (str, 0, 3);
> > + memset (str, 0, 3);
> > *str1 = (char)(bit + 48);
> > strncpy (str, str1, 1);
> > memset (str1, 0, 3);
> Wow! *str1 is 2 bytes long, not 3!

yup.

> Anyway, here is the diff against some old 2.5 (sorry don't have latest
> tree here at the moment). Also here are old and new functions
> for easy visual diff. Completely untested:

New 2.5 code does not have this function at all.
I will look into porting 2.5 changes back to 2.4 tonight. This seems to be proper solution
in this case.

Bye,
Oleg
-
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: 2005-03-22 13:33    [W:0.041 / U:0.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site