Re: [Suggestion] drivers/usb/core: dev-config and dev->rawdescriptors, when processing failure.

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

 



On Thu, 6 Dec 2012, Chen Gang wrote:

> Hello Oliver Neukum:
> 
> in drivers/usb/core/config.c, for function usb_get_configuration:
> 
>   if processing failed at line 694, we will goto err2 (line 755..759) 
>   in this condition, we do not free dev-config and dev->rawdescriptors.

This isn't necessary.  They are freed in usb_destroy_configuration().

>   after checking another relative source code, it seems not an issue (I am not quite sure).
>   but I still suggest to:
>     free them, when failure occurs
>     or check them whether be NULL before new allocation, (if not NULL, free them firstly).

There never is any new allocation.  usb_get_configuration() is called 
only once for any device.  (For an example of this sort of check, see 
usb_enumerate_device() in hub.c.)

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux