linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio_fs.c: add check kmalloc return
@ 2022-09-24 14:17 liujing
  2022-09-24 21:41 ` Joe Perches
  2022-09-25 10:31 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: liujing @ 2022-09-24 14:17 UTC (permalink / raw)
  To: vgoyal; +Cc: stefanha, miklos, linux-fsdevel, linux-kernel, liujing

Signed-off-by: liujing <liujing@cmss.chinamobile.com>
---
 fs/fuse/virtio_fs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index 4d8d4f16c727..07334c9c2883 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -989,6 +989,10 @@ __releases(fiq->lock)
 
 	/* Allocate a buffer for the request */
 	forget = kmalloc(sizeof(*forget), GFP_NOFS | __GFP_NOFAIL);
+
+	if (forget == NULL)
+		return -ENOMEM;
+
 	req = &forget->req;
 
 	req->ih = (struct fuse_in_header){
-- 
2.18.2




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

end of thread, other threads:[~2022-09-25 10:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-24 14:17 [PATCH] virtio_fs.c: add check kmalloc return liujing
2022-09-24 21:41 ` Joe Perches
2022-09-25 10:31 ` kernel test robot

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).