[PATCH] staging: rtl8712: Fix freeing ERR_PTR

Gujulan Elango, Hari Prasath (H.) hgujulan at visteon.com
Thu Apr 30 05:59:59 UTC 2015


From: Julia Lawall <julia.lawall at lip6.fr>
Sent: Thursday, April 30, 2015 12:12 AM
To: Gujulan Elango, Hari Prasath (H.)
Cc: shack at linux.com; cristina.opriceana at gmail.com; hamohammed.sa at gmail.com; vitaly.osipov at gmail.com; devel at driverdev.osuosl.org
Subject: Re: [PATCH] staging: rtl8712: Fix freeing ERR_PTR

On Wed, 29 Apr 2015, Gujulan Elango, Hari Prasath (H.) wrote:

> The return value of memdup_user is a pointer to errno.Freeing it will cause
> error.Hence set it to NULL before branching to free the pointer.smatch also
> raises the same warning.

Perhaps there is no point to jumping to the label if there is nothing to
do there.

The code contains other strange things, like:

        if (status) {
                ret = -EFAULT;
                goto _r871x_mp_ioctl_hdl_exit;
        }
_r871x_mp_ioctl_hdl_exit:

Overall, it would be nice to see if the code could be reorganized so that
there is only a goto if there is something to do to cleanup, so that
return ret would only be executed in an error case, and so that the code
would return 0 directly on success.


thanks for your comments. I am sending version 2 of the patch for review.


More information about the devel mailing list