public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iscsi-target: return -ENOMEM instead of -1 in case of failed kmalloc()
@ 2015-10-19 20:18 Luis de Bethencourt
  2015-10-20 11:41 ` Sagi Grimberg
  2015-11-14 22:31 ` Nicholas A. Bellinger
  0 siblings, 2 replies; 4+ messages in thread
From: Luis de Bethencourt @ 2015-10-19 20:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: nab, cvubrugier, sagig, linux-scsi, target-devel,
	Luis de Bethencourt

Smatch complains about returning hard coded error codes, silence this
warning.

drivers/target/iscsi/iscsi_target_parameters.c:211 iscsi_create_default_params() warn: returning -1 instead of -ENOMEM is sloppy

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
---

Hi,

This doesn't change the functionality. It is just about using the more specific
errno. And at the same time silencing smatch.

Thanks,
Luis

 drivers/target/iscsi/iscsi_target_parameters.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c
index 51d1734..2cbea2a 100644
--- a/drivers/target/iscsi/iscsi_target_parameters.c
+++ b/drivers/target/iscsi/iscsi_target_parameters.c
@@ -208,7 +208,7 @@ int iscsi_create_default_params(struct iscsi_param_list **param_list_ptr)
 	if (!pl) {
 		pr_err("Unable to allocate memory for"
 				" struct iscsi_param_list.\n");
-		return -1 ;
+		return -ENOMEM;
 	}
 	INIT_LIST_HEAD(&pl->param_list);
 	INIT_LIST_HEAD(&pl->extra_response_list);
@@ -578,7 +578,7 @@ int iscsi_copy_param_list(
 	param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL);
 	if (!param_list) {
 		pr_err("Unable to allocate memory for struct iscsi_param_list.\n");
-		return -1;
+		return -ENOMEM;
 	}
 	INIT_LIST_HEAD(&param_list->param_list);
 	INIT_LIST_HEAD(&param_list->extra_response_list);
@@ -629,7 +629,7 @@ int iscsi_copy_param_list(
 
 err_out:
 	iscsi_release_param_list(param_list);
-	return -1;
+	return -ENOMEM;
 }
 
 static void iscsi_release_extra_responses(struct iscsi_param_list *param_list)
@@ -729,7 +729,7 @@ static int iscsi_add_notunderstood_response(
 	if (!extra_response) {
 		pr_err("Unable to allocate memory for"
 			" struct iscsi_extra_response.\n");
-		return -1;
+		return -ENOMEM;
 	}
 	INIT_LIST_HEAD(&extra_response->er_list);
 
@@ -1370,7 +1370,7 @@ int iscsi_decode_text_input(
 	tmpbuf = kzalloc(length + 1, GFP_KERNEL);
 	if (!tmpbuf) {
 		pr_err("Unable to allocate %u + 1 bytes for tmpbuf.\n", length);
-		return -1;
+		return -ENOMEM;
 	}
 
 	memcpy(tmpbuf, textbuf, length);
-- 
2.5.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] iscsi-target: return -ENOMEM instead of -1 in case of failed kmalloc()
  2015-10-19 20:18 [PATCH] iscsi-target: return -ENOMEM instead of -1 in case of failed kmalloc() Luis de Bethencourt
@ 2015-10-20 11:41 ` Sagi Grimberg
  2015-11-14 22:31 ` Nicholas A. Bellinger
  1 sibling, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2015-10-20 11:41 UTC (permalink / raw)
  To: Luis de Bethencourt, linux-kernel
  Cc: nab, cvubrugier, sagig, linux-scsi, target-devel

On 10/19/2015 11:18 PM, Luis de Bethencourt wrote:
> Smatch complains about returning hard coded error codes, silence this
> warning.
>
> drivers/target/iscsi/iscsi_target_parameters.c:211 iscsi_create_default_params() warn: returning -1 instead of -ENOMEM is sloppy
>
> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>

Looks good,

Reviewed-by: Sagi Grimberg <sagig@mellanox.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iscsi-target: return -ENOMEM instead of -1 in case of failed kmalloc()
  2015-10-19 20:18 [PATCH] iscsi-target: return -ENOMEM instead of -1 in case of failed kmalloc() Luis de Bethencourt
  2015-10-20 11:41 ` Sagi Grimberg
@ 2015-11-14 22:31 ` Nicholas A. Bellinger
  2015-11-15  1:11   ` Luis de Bethencourt
  1 sibling, 1 reply; 4+ messages in thread
From: Nicholas A. Bellinger @ 2015-11-14 22:31 UTC (permalink / raw)
  To: Luis de Bethencourt
  Cc: linux-kernel, cvubrugier, sagig, linux-scsi, target-devel

Hi Luis,

Apologies for the delayed response.

On Mon, 2015-10-19 at 21:18 +0100, Luis de Bethencourt wrote:
> Smatch complains about returning hard coded error codes, silence this
> warning.
> 
> drivers/target/iscsi/iscsi_target_parameters.c:211 iscsi_create_default_params() warn: returning -1 instead of -ENOMEM is sloppy
> 
> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
> ---
> 
> Hi,
> 
> This doesn't change the functionality. It is just about using the more specific
> errno. And at the same time silencing smatch.
> 
> Thanks,
> Luis
> 
>  drivers/target/iscsi/iscsi_target_parameters.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 

Applied to target-pending/queue-fixes.

Thank you,

--nab



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iscsi-target: return -ENOMEM instead of -1 in case of failed kmalloc()
  2015-11-14 22:31 ` Nicholas A. Bellinger
@ 2015-11-15  1:11   ` Luis de Bethencourt
  0 siblings, 0 replies; 4+ messages in thread
From: Luis de Bethencourt @ 2015-11-15  1:11 UTC (permalink / raw)
  To: Nicholas A. Bellinger
  Cc: linux-kernel, cvubrugier, sagig, linux-scsi, target-devel

On 14/11/15 22:31, Nicholas A. Bellinger wrote:
> Hi Luis,
> 
> Apologies for the delayed response.
>

No worries. I understand maintainers are very busy.

Thanks for taking the time to review and merge :)

Enjoy your weekend,
Luis

 
> On Mon, 2015-10-19 at 21:18 +0100, Luis de Bethencourt wrote:
>> Smatch complains about returning hard coded error codes, silence this
>> warning.
>>
>> drivers/target/iscsi/iscsi_target_parameters.c:211 iscsi_create_default_params() warn: returning -1 instead of -ENOMEM is sloppy
>>
>> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
>> ---
>>
>> Hi,
>>
>> This doesn't change the functionality. It is just about using the more specific
>> errno. And at the same time silencing smatch.
>>
>> Thanks,
>> Luis
>>
>>  drivers/target/iscsi/iscsi_target_parameters.c | 10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
> 
> Applied to target-pending/queue-fixes.
> 
> Thank you,
> 
> --nab
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-15  1:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-19 20:18 [PATCH] iscsi-target: return -ENOMEM instead of -1 in case of failed kmalloc() Luis de Bethencourt
2015-10-20 11:41 ` Sagi Grimberg
2015-11-14 22:31 ` Nicholas A. Bellinger
2015-11-15  1:11   ` Luis de Bethencourt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox