Mikey:

Good catch. Will resolve this in the v6 patch.

Thanks,
- Manoj

On 8/13/2015 5:53 AM, Michael Neuling wrote:

+
+       ctxi = kzalloc(sizeof(*ctxi), GFP_KERNEL);
+       lli = kzalloc((MAX_RHT_PER_CONTEXT * sizeof(*lli)), GFP_KERNEL);
+       if (unlikely(!ctxi || !lli)) {
+               dev_err(dev, "%s: Unable to allocate context!\n", __func__);
+               goto out;

If only one of these allocations fails you'll leak some memory.  I
suggest making this "goto err", remove the "out" label and make err
look like this:

err:
        if lli
                kfree(lli);
        if ctxi
                kfree(ctxi);
        return NULL;

Since kfree() handles being passed a NULL pointer, we will change this also to 'goto err'.

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to