From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============6158051123223370933==" MIME-Version: 1.0 From: kbuild test robot 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 Message-ID: <20200318201922.GA78906@3daedc0c61ce> In-Reply-To: <202003190410.HPD6ohXD%lkp@intel.com> List-Id: --===============6158051123223370933== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: kbuild test robot 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 Vide= o V4L2 driver") CC: Dmitry Sepp Signed-off-by: kbuild test robot --- tree: https://chromium.googlesource.com/chromiumos/third_party/kernel chr= omeos-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 =3D kmem_cache_alloc(vv->vbufs, GFP_KERNEL); + vbuf =3D 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 =3D (void *)vbuf + sizeof(*vbuf); --===============6158051123223370933==--