Re: [PATCH] scsi: ses fix for len and mem leaking when fail to add intf

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: James Bottomley
Date: Saturday, February 9, 2008 - 8:00 am

On Sat, 2008-02-09 at 04:13 -0800, Yinghai Lu wrote:

This one is a bit unnecessary; C promotion rules guarantee that
everything is promoted to int (or above) before doing arithmetic.  Since
it's only ever done on 16 bits, signed or unsigned int is adequate for
the conversion.


Yes, I see that, thanks!  There's also the kmalloc of scomp which should
be kzalloc if you care to fix that up in the resend.


Space cleanups also need mention in the changelog.


Neither of us gets this right.  By removing the kfree(buf) from the
err_free path, you cause a leak here.  I cause a double free.  I think
putting back the kfree(buf) and keeping this hunk is the fix.


Yes, prevents double free (but only if buf is freed).


It's probably better to move these closer to the statements that make
them necessary (in this case above the comment).


kfree(scomp) should be in the err_free path just in case someone else
adds something to this.
 

What exactly is this supposed to be doing, and why 7?  If you're
thinking of conditioning the page 7 receive on the success of the
allocation, we really need the allocation failure report more than we
need the driver to attach.


This is rather pointless, isn't it?


You can't remove this.  Also add kfree(scomp) here.


Yes, a bug, thanks.


James


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] scsi: ses fix for len and mem leaking when fai ..., James Bottomley, (Sat Feb 9, 8:00 am)
Re: [PATCH] scsi: ses fix mem leaking when fail to add intf, James Bottomley, (Sun Feb 10, 9:28 pm)
[SCSI] ses: fix memory leaks, Yinghai Lu, (Mon Feb 11, 12:25 am)
Re: [SCSI] ses: fix memory leaks, James Bottomley, (Mon Feb 11, 9:23 am)
Re: [SCSI] ses: fix memory leaks, James Bottomley, (Mon Feb 11, 10:02 am)
Re: [SCSI] ses: fix memory leaks, Yinghai Lu, (Mon Feb 11, 1:25 pm)
[PATCH] SCSI: fix data corruption caused by ses, Yinghai Lu, (Wed Feb 13, 12:10 am)
Re: [PATCH] SCSI: fix data corruption caused by ses, James Bottomley, (Wed Feb 13, 4:25 pm)
Re: [PATCH] SCSI: fix data corruption caused by ses, Yinghai Lu, (Wed Feb 13, 5:07 pm)
[PATCH] SCSI: fix data corruption caused by ses v2, Yinghai Lu, (Wed Feb 13, 5:25 pm)
Re: [PATCH] SCSI: fix data corruption caused by ses v2, James Bottomley, (Fri Feb 15, 8:53 am)
Re: [PATCH] SCSI: fix data corruption caused by ses v2, Yinghai Lu, (Fri Feb 15, 11:44 am)