Staging: emxx_udc: Make a read-only structure
PATCH 1/1 Staging: emxx_udc: Make a read-only structure
This patch add const qualifier at the declaration of the structure. The structure become a read-only data, this increase the security.
Found with Coccinelle:
@r disable optional_qualifier@
identifier s,i;
@@
* static struct s i ={...};
--- drivers/staging/emxx_udc/emxx_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/emxx_udc/emxx_udc.c +1 -1
@@ -1386,7 +1386,7 @@ static void _nbu2ss_set_endpoint_stall(/*-------------------------------------------------------------------------*/ /* Device Descriptor */ -static struct usb_device_descriptor device_desc = { +static const struct usb_device_descriptor device_desc = { .bLength =sizeof (device_desc), .bDescriptorType =USB_DT_DEVICE , .bcdUSB =cpu_to_le16 (0x0200 ),
Signature · 1 line
2.7.4
Quoted 8 lines · Mihaela Muraru
This patch add const qualifier at the declaration of the structure. The structure become a read-only data, this increase the security.
Found with Coccinelle:
@r disable optional_qualifier@
identifier s,i;
@@
* static struct s i ={...};
This just shows that the structure didn't have const before and that you have now added it. It would be better to explain why you consider that this is the right thing to do.
julia
Quoted 29 lines
Signed-off-by Mihaela Muraru <[email protected]>--- drivers/staging/emxx_udc/emxx_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/emxx_udc/emxx_udc.c +1
-2@@ -1386,7 +1386,7 @@ static void _nbu2ss_set_endpoint_stall(/*-------------------------------------------------------------------------*/ /* Device Descriptor */ -static struct usb_device_descriptor device_desc = { +static const struct usb_device_descriptor device_desc = { .bLength =sizeof (device_desc), .bDescriptorType =USB_DT_DEVICE , .bcdUSB =cpu_to_le16 (0x0200 ), --2.7.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20161017143352.GA13131%40domino-MS-16Y1.
For more options, visit https://groups.google.com/d/optout.