* [PATCH 0/2] usbnet: Adjustments for usbnet_write_cmd_async() @ 2017-05-22 5:07 ` SF Markus Elfring 0 siblings, 0 replies; 11+ messages in thread From: SF Markus Elfring @ 2017-05-22 5:07 UTC (permalink / raw) To: linux-usb, netdev, Oliver Neukum; +Cc: LKML, kernel-janitors From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 22 May 2017 07:04:03 +0200 Two update suggestions were taken into account from static source code analysis. Markus Elfring (2): Delete an error message for a failed memory allocation Improve a size determination drivers/net/usb/usbnet.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 2.13.0 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 0/2] usbnet: Adjustments for usbnet_write_cmd_async() @ 2017-05-22 5:07 ` SF Markus Elfring 0 siblings, 0 replies; 11+ messages in thread From: SF Markus Elfring @ 2017-05-22 5:07 UTC (permalink / raw) To: linux-usb, netdev, Oliver Neukum; +Cc: LKML, kernel-janitors From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 22 May 2017 07:04:03 +0200 Two update suggestions were taken into account from static source code analysis. Markus Elfring (2): Delete an error message for a failed memory allocation Improve a size determination drivers/net/usb/usbnet.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 2.13.0 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/2] usbnet: Delete an error message for a failed memory allocation in usbnet_write_cmd_async 2017-05-22 5:07 ` SF Markus Elfring @ 2017-05-22 5:09 ` SF Markus Elfring -1 siblings, 0 replies; 11+ messages in thread From: SF Markus Elfring @ 2017-05-22 5:09 UTC (permalink / raw) To: linux-usb, netdev, Oliver Neukum; +Cc: LKML, kernel-janitors From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 22 May 2017 06:33:48 +0200 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/net/usb/usbnet.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 79048e72c1bd..802ba68d37d1 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -2124,10 +2124,7 @@ int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype, if (data) { buf = kmemdup(data, size, GFP_ATOMIC); - if (!buf) { - netdev_err(dev->net, "Error allocating buffer" - " in %s!\n", __func__); + if (!buf) goto fail_free; - } } -- 2.13.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 1/2] usbnet: Delete an error message for a failed memory allocation in usbnet_write_cmd_async() @ 2017-05-22 5:09 ` SF Markus Elfring 0 siblings, 0 replies; 11+ messages in thread From: SF Markus Elfring @ 2017-05-22 5:09 UTC (permalink / raw) To: linux-usb, netdev, Oliver Neukum; +Cc: LKML, kernel-janitors From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 22 May 2017 06:33:48 +0200 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/net/usb/usbnet.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 79048e72c1bd..802ba68d37d1 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -2124,10 +2124,7 @@ int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype, if (data) { buf = kmemdup(data, size, GFP_ATOMIC); - if (!buf) { - netdev_err(dev->net, "Error allocating buffer" - " in %s!\n", __func__); + if (!buf) goto fail_free; - } } -- 2.13.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] usbnet: Delete an error message for a failed memory allocation in usbnet_write_cmd_a 2017-05-22 5:09 ` [PATCH 1/2] usbnet: Delete an error message for a failed memory allocation in usbnet_write_cmd_async() SF Markus Elfring @ 2017-05-22 7:08 ` Oliver Neukum -1 siblings, 0 replies; 11+ messages in thread From: Oliver Neukum @ 2017-05-22 7:08 UTC (permalink / raw) To: SF Markus Elfring, linux-usb, netdev; +Cc: kernel-janitors, LKML Am Montag, den 22.05.2017, 07:09 +0200 schrieb SF Markus Elfring: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Mon, 22 May 2017 06:33:48 +0200 > > Omit an extra message for a memory allocation failure in this function. > > This issue was detected by using the Coccinelle software. > > Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Oliver Neukum <oneukum@suse.com> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] usbnet: Delete an error message for a failed memory allocation in usbnet_write_cmd_async() @ 2017-05-22 7:08 ` Oliver Neukum 0 siblings, 0 replies; 11+ messages in thread From: Oliver Neukum @ 2017-05-22 7:08 UTC (permalink / raw) To: SF Markus Elfring, linux-usb, netdev; +Cc: kernel-janitors, LKML Am Montag, den 22.05.2017, 07:09 +0200 schrieb SF Markus Elfring: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Mon, 22 May 2017 06:33:48 +0200 > > Omit an extra message for a memory allocation failure in this function. > > This issue was detected by using the Coccinelle software. > > Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Oliver Neukum <oneukum@suse.com> ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/2] usbnet: Improve a size determination in usbnet_write_cmd_async() 2017-05-22 5:07 ` SF Markus Elfring (?) @ 2017-05-22 5:10 ` SF Markus Elfring -1 siblings, 0 replies; 11+ messages in thread From: SF Markus Elfring @ 2017-05-22 5:10 UTC (permalink / raw) To: linux-usb, netdev, Oliver Neukum; +Cc: LKML, kernel-janitors From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 22 May 2017 06:42:33 +0200 Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/net/usb/usbnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 802ba68d37d1..b73c2a40501c 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -2129,6 +2129,6 @@ int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype, } - req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC); + req = kmalloc(sizeof(*req), GFP_ATOMIC); if (!req) goto fail_free_buf; -- 2.13.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/2] usbnet: Improve a size determination in usbnet_write_cmd_async() @ 2017-05-22 5:10 ` SF Markus Elfring 0 siblings, 0 replies; 11+ messages in thread From: SF Markus Elfring @ 2017-05-22 5:10 UTC (permalink / raw) To: linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum Cc: LKML, kernel-janitors-u79uwXL29TY76Z2rM5mHXA From: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org> Date: Mon, 22 May 2017 06:42:33 +0200 Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org> --- drivers/net/usb/usbnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 802ba68d37d1..b73c2a40501c 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -2129,6 +2129,6 @@ int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype, } - req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC); + req = kmalloc(sizeof(*req), GFP_ATOMIC); if (!req) goto fail_free_buf; -- 2.13.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/2] usbnet: Improve a size determination in usbnet_write_cmd_async() @ 2017-05-22 5:10 ` SF Markus Elfring 0 siblings, 0 replies; 11+ messages in thread From: SF Markus Elfring @ 2017-05-22 5:10 UTC (permalink / raw) To: linux-usb, netdev, Oliver Neukum; +Cc: LKML, kernel-janitors From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 22 May 2017 06:42:33 +0200 Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/net/usb/usbnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 802ba68d37d1..b73c2a40501c 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -2129,6 +2129,6 @@ int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype, } - req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC); + req = kmalloc(sizeof(*req), GFP_ATOMIC); if (!req) goto fail_free_buf; -- 2.13.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] usbnet: Improve a size determination in usbnet_write_cmd_async() 2017-05-22 5:10 ` SF Markus Elfring @ 2017-05-22 7:08 ` Oliver Neukum -1 siblings, 0 replies; 11+ messages in thread From: Oliver Neukum @ 2017-05-22 7:08 UTC (permalink / raw) To: SF Markus Elfring, linux-usb, netdev; +Cc: kernel-janitors, LKML Am Montag, den 22.05.2017, 07:10 +0200 schrieb SF Markus Elfring: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Mon, 22 May 2017 06:42:33 +0200 > > Replace the specification of a data structure by a pointer dereference > as the parameter for the operator "sizeof" to make the corresponding size > determination a bit safer according to the Linux coding style convention. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Oliver Neukum <oneukum@suse.com> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] usbnet: Improve a size determination in usbnet_write_cmd_async() @ 2017-05-22 7:08 ` Oliver Neukum 0 siblings, 0 replies; 11+ messages in thread From: Oliver Neukum @ 2017-05-22 7:08 UTC (permalink / raw) To: SF Markus Elfring, linux-usb, netdev; +Cc: kernel-janitors, LKML Am Montag, den 22.05.2017, 07:10 +0200 schrieb SF Markus Elfring: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Mon, 22 May 2017 06:42:33 +0200 > > Replace the specification of a data structure by a pointer dereference > as the parameter for the operator "sizeof" to make the corresponding size > determination a bit safer according to the Linux coding style convention. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Oliver Neukum <oneukum@suse.com> ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-05-22 7:10 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-05-22 5:07 [PATCH 0/2] usbnet: Adjustments for usbnet_write_cmd_async() SF Markus Elfring 2017-05-22 5:07 ` SF Markus Elfring 2017-05-22 5:09 ` [PATCH 1/2] usbnet: Delete an error message for a failed memory allocation in usbnet_write_cmd_async SF Markus Elfring 2017-05-22 5:09 ` [PATCH 1/2] usbnet: Delete an error message for a failed memory allocation in usbnet_write_cmd_async() SF Markus Elfring 2017-05-22 7:08 ` [PATCH 1/2] usbnet: Delete an error message for a failed memory allocation in usbnet_write_cmd_a Oliver Neukum 2017-05-22 7:08 ` [PATCH 1/2] usbnet: Delete an error message for a failed memory allocation in usbnet_write_cmd_async() Oliver Neukum 2017-05-22 5:10 ` [PATCH 2/2] usbnet: Improve a size determination " SF Markus Elfring 2017-05-22 5:10 ` SF Markus Elfring 2017-05-22 5:10 ` SF Markus Elfring 2017-05-22 7:08 ` Oliver Neukum 2017-05-22 7:08 ` Oliver Neukum
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.