aboutsummaryrefslogtreecommitdiff
path: root/drivers/hv
diff options
context:
space:
mode:
authorLv Ruyi2021-10-28 10:41:38 +0000
committerWei Liu2021-10-28 11:40:32 +0000
commit01ccca3cb50dcff7eea01448af985a49859b8a1d (patch)
treeda3018a594e3fd0e4ac37c5f07ae2b4ab2f8f2d8 /drivers/hv
parent0b9060852344cdaa3b415f807943d71e488c4eec (diff)
Drivers: hv : vmbus: Adding NULL pointer check
This patch fixes the following Coccinelle warning: drivers/hv/ring_buffer.c:223: alloc with no test Reported-by: Zeal Robot <zealci@zte.com.cn> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn> Link: https://lore.kernel.org/r/20211028104138.14576-1-lv.ruyi@zte.com.cn Signed-off-by: Wei Liu <wei.liu@kernel.org>
Diffstat (limited to 'drivers/hv')
-rw-r--r--drivers/hv/ring_buffer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index 931802ae985c..71efacb90965 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -223,6 +223,8 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
pages_wraparound = kcalloc(page_cnt * 2 - 1,
sizeof(struct page *),
GFP_KERNEL);
+ if (!pages_wraparound)
+ return -ENOMEM;
pages_wraparound[0] = pages;
for (i = 0; i < 2 * (page_cnt - 1); i++)