All of lore.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [PATCH] BACKPORT: FROMLIST: virtio_video: fix zalloc-simple.cocci warnings
Date: Thu, 19 Mar 2020 04:19:22 +0800	[thread overview]
Message-ID: <20200318201922.GA78906@3daedc0c61ce> (raw)
In-Reply-To: <202003190410.HPD6ohXD%lkp@intel.com>

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

From: kbuild test robot <lkp@intel.com>

drivers/media/virtio/virtio_video_vq.c:92:8-24: WARNING: kmem_cache_zalloc should be used for vbuf, instead of kmem_cache_alloc/memset


 Use zeroing allocator rather than allocator followed by memset with 0

 This considers some simple cases that are common and easy to validate
 Note in particular that there are no ...s in the rule, so all of the
 matched code has to be contiguous

Generated by: scripts/coccinelle/api/alloc/zalloc-simple.cocci

Fixes: bbca48582a73 ("BACKPORT: FROMLIST: virtio_video: Add the Virtio Video V4L2 driver")
CC: Dmitry Sepp <dmitry.sepp@opensynergy.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
---

tree:   https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-5.4
head:   4ab03425ee573fd6b97746d319f2c88b465a1534
commit: bbca48582a7342c1201691ce0eb08f1538376538 [34/43] BACKPORT: FROMLIST: virtio_video: Add the Virtio Video V4L2 driver

Please take the patch only if it's a positive warning. Thanks!

 virtio_video_vq.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/media/virtio/virtio_video_vq.c
+++ b/drivers/media/virtio/virtio_video_vq.c
@@ -89,10 +89,9 @@ virtio_video_get_vbuf(struct virtio_vide
 {
 	struct virtio_video_vbuffer *vbuf;
 
-	vbuf = kmem_cache_alloc(vv->vbufs, GFP_KERNEL);
+	vbuf = kmem_cache_zalloc(vv->vbufs, GFP_KERNEL);
 	if (!vbuf)
 		return ERR_PTR(-ENOMEM);
-	memset(vbuf, 0, VBUFFER_SIZE);
 
 	BUG_ON(size > MAX_INLINE_CMD_SIZE);
 	vbuf->buf = (void *)vbuf + sizeof(*vbuf);

      parent reply	other threads:[~2020-03-18 20:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18 20:19 [chrome-os:chromeos-5.4 34/43] drivers/media/virtio/virtio_video_caps.c:298:5-11: ERROR: allocation function on line 297 returns NULL not ERR_PTR on failure kbuild test robot
2020-03-18 20:19 ` [PATCH] BACKPORT: FROMLIST: virtio_video: fix eno.cocci warnings kbuild test robot
2020-03-18 20:19 ` kbuild test robot
2020-03-18 20:19 ` kbuild test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200318201922.GA78906@3daedc0c61ce \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.