kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [target:for-linus 1/1] drivers/vhost/tcm_vhost.c:537:23-29: ERROR: allocation function on line 533 r
@ 2012-07-28 10:20 Fengguang Wu
  2012-07-30 22:24 ` [target:for-linus 1/1] drivers/vhost/tcm_vhost.c:537:23-29: ERROR: allocation function on line 5 Nicholas A. Bellinger
  0 siblings, 1 reply; 2+ messages in thread
From: Fengguang Wu @ 2012-07-28 10:20 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 865 bytes --]

Hi Nicholas,

There are new coccinelle warnings show up in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git for-linus
head:   fd682824bcdab8cbb3d078f9f59ba531e3e41484
commit: fd682824bcdab8cbb3d078f9f59ba531e3e41484 [1/1] tcm_vhost: Initial merge for vhost level target fabric driver

All coccinelle warnings:

drivers/vhost/tcm_vhost.c:537:23-29: ERROR: allocation function on line 533 returns NULL not ERR_PTR on failure

vim +537 drivers/vhost/tcm_vhost.c
   534		if (!sg)
   535			return -ENOMEM;
   536		pr_debug("%s sg %p sgl_count %u is_err %ld\n", __func__,
 > 537		       sg, sgl_count, IS_ERR(sg));
   538		sg_init_table(sg, sgl_count);
   539	
   540		tv_cmd->tvc_sgl = sg;

---
0-DAY kernel build testing backend         Open Source Technology Centre
Fengguang Wu <wfg@linux.intel.com>                     Intel Corporation

[-- Attachment #2: 7750-7768.patch --]
[-- Type: text/x-diff, Size: 477 bytes --]

Generated by: null/eno.cocci

 The various basic memory allocation functions don't return ERR_PTR

--- /c/kernel-tests/src/linux/drivers/vhost/tcm_vhost.c
+++ /tmp/cocci-output-16473-2fe139-tcm_vhost.c
@@ -534,7 +534,7 @@ static int vhost_scsi_map_iov_to_sgl(str
 	if (!sg)
 		return -ENOMEM;
 	pr_debug("%s sg %p sgl_count %u is_err %ld\n", __func__,
-	       sg, sgl_count, IS_ERR(sg));
+	       sg, sgl_count, !sg);
 	sg_init_table(sg, sgl_count);
 
 	tv_cmd->tvc_sgl = sg;

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

* Re: [target:for-linus 1/1] drivers/vhost/tcm_vhost.c:537:23-29: ERROR: allocation function on line 5
  2012-07-28 10:20 [target:for-linus 1/1] drivers/vhost/tcm_vhost.c:537:23-29: ERROR: allocation function on line 533 r Fengguang Wu
@ 2012-07-30 22:24 ` Nicholas A. Bellinger
  0 siblings, 0 replies; 2+ messages in thread
From: Nicholas A. Bellinger @ 2012-07-30 22:24 UTC (permalink / raw)
  To: kernel-janitors

On Sat, 2012-07-28 at 18:20 +0800, Fengguang Wu wrote:
> Hi Nicholas,
> 
> There are new coccinelle warnings show up in
> 
> tree:   git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git for-linus
> head:   fd682824bcdab8cbb3d078f9f59ba531e3e41484
> commit: fd682824bcdab8cbb3d078f9f59ba531e3e41484 [1/1] tcm_vhost: Initial merge for vhost level target fabric driver
> 
> All coccinelle warnings:
> 
> drivers/vhost/tcm_vhost.c:537:23-29: ERROR: allocation function on line 533 returns NULL not ERR_PTR on failure
> 
> vim +537 drivers/vhost/tcm_vhost.c
>    534		if (!sg)
>    535			return -ENOMEM;
>    536		pr_debug("%s sg %p sgl_count %u is_err %ld\n", __func__,
>  > 537		       sg, sgl_count, IS_ERR(sg));
>    538		sg_init_table(sg, sgl_count);
>    539	
>    540		tv_cmd->tvc_sgl = sg;
> 
> ---
> 0-DAY kernel build testing backend         Open Source Technology Centre
> Fengguang Wu <wfg@linux.intel.com>                     Intel Corporation

I've included this fix into a post-merge series for tcm-vhost.

Also FYI, I changed this patch slightly to use %d as it was still
generating a format spec warning.. 

Thanks WU!


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

end of thread, other threads:[~2012-07-30 22:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-28 10:20 [target:for-linus 1/1] drivers/vhost/tcm_vhost.c:537:23-29: ERROR: allocation function on line 533 r Fengguang Wu
2012-07-30 22:24 ` [target:for-linus 1/1] drivers/vhost/tcm_vhost.c:537:23-29: ERROR: allocation function on line 5 Nicholas A. Bellinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).