Re: [PATCH 1/2] usbip: Delete an error message for a failed memory allocation in two functions

2017-12-06 Thread SF Markus Elfring
>> Omit an extra message for a memory allocation failure in these functions.
>>
>> This issue was detected by using the Coccinelle software.
> 
> Please include the problem

Do you find the wording “WARNING: Possible unnecessary 'out of memory' message”
from the script “checkpatch.pl” more reasonable?


> and log from Coccinelle software

There is no log file from which I could extract something for this case.


> in any future patches for the issues detected by Coccinelle.

Would you like to help a bit to make the commit message better for your needs?


>> @@ -466,7 +465,6 @@ static void stub_recv_cmd_submit(struct stub_device 
>> *sdev,
>>  priv->urb->setup_packet = kmemdup(>u.cmd_submit.setup, 8,
>>GFP_KERNEL);
>>  if (!priv->urb->setup_packet) {
>> -dev_err(>dev, "allocate setup_packet\n");
> 
> If Coccinelle found this as an extra message,
> there is something wrong with the Coccinelle script.

The source code analysis approach could be improved somehow.


> This is not an extra message.

There can be different opinions around the handling of such exceptional 
situations.


> This message is for the second kmemdup() failure and is necessary.

This function is called only once within the implementation of
the function “stub_recv_cmd_submit” (and in this source file).

Do you find a default Linux allocation failure report insufficient?

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


Re: [PATCH 1/2] usbip: Delete an error message for a failed memory allocation in two functions

2017-12-05 Thread Shuah Khan
On 12/05/2017 02:49 PM, SF Markus Elfring wrote:
> From: Markus Elfring 
> Date: Tue, 5 Dec 2017 22:25:38 +0100
> 
> Omit an extra message for a memory allocation failure in these functions.
> 
> This issue was detected by using the Coccinelle software.

Please include the problem and log from Coccinelle software in any
future patches for the issues detected by Coccinelle.

> 
> Signed-off-by: Markus Elfring 
> ---
>  drivers/usb/usbip/stub_rx.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/usb/usbip/stub_rx.c b/drivers/usb/usbip/stub_rx.c
> index 536e037f541f..a70eb81823a3 100644
> --- a/drivers/usb/usbip/stub_rx.c
> +++ b/drivers/usb/usbip/stub_rx.c
> @@ -302,7 +302,6 @@ static struct stub_priv *stub_priv_alloc(struct 
> stub_device *sdev,
>  
>   priv = kmem_cache_zalloc(stub_priv_cache, GFP_ATOMIC);
>   if (!priv) {
> - dev_err(>udev->dev, "alloc stub_priv\n");
>   spin_unlock_irqrestore(>priv_lock, flags);
>   usbip_event_add(ud, SDEV_EVENT_ERROR_MALLOC);
>   return NULL;
> @@ -466,7 +465,6 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,
>   priv->urb->setup_packet = kmemdup(>u.cmd_submit.setup, 8,
> GFP_KERNEL);
>   if (!priv->urb->setup_packet) {
> - dev_err(>dev, "allocate setup_packet\n");

If Coccinelle found this as an extra message, there is something
wrong with the Coccinelle script. This is not an extra message.
This message is for the second kmemdup() failure and is necessary.

>   usbip_event_add(ud, SDEV_EVENT_ERROR_MALLOC);
>   return;
>   }
> 

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


[PATCH 1/2] usbip: Delete an error message for a failed memory allocation in two functions

2017-12-05 Thread SF Markus Elfring
From: Markus Elfring 
Date: Tue, 5 Dec 2017 22:25:38 +0100

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/usb/usbip/stub_rx.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/usb/usbip/stub_rx.c b/drivers/usb/usbip/stub_rx.c
index 536e037f541f..a70eb81823a3 100644
--- a/drivers/usb/usbip/stub_rx.c
+++ b/drivers/usb/usbip/stub_rx.c
@@ -302,7 +302,6 @@ static struct stub_priv *stub_priv_alloc(struct stub_device 
*sdev,
 
priv = kmem_cache_zalloc(stub_priv_cache, GFP_ATOMIC);
if (!priv) {
-   dev_err(>udev->dev, "alloc stub_priv\n");
spin_unlock_irqrestore(>priv_lock, flags);
usbip_event_add(ud, SDEV_EVENT_ERROR_MALLOC);
return NULL;
@@ -466,7 +465,6 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,
priv->urb->setup_packet = kmemdup(>u.cmd_submit.setup, 8,
  GFP_KERNEL);
if (!priv->urb->setup_packet) {
-   dev_err(>dev, "allocate setup_packet\n");
usbip_event_add(ud, SDEV_EVENT_ERROR_MALLOC);
return;
}
-- 
2.15.1

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