Commit 01ccca3c authored by Lv Ruyi's avatar Lv Ruyi Committed by Wei Liu

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: default avatarZeal Robot <zealci@zte.com.cn>
Signed-off-by: default avatarLv Ruyi <lv.ruyi@zte.com.cn>
Link: https://lore.kernel.org/r/20211028104138.14576-1-lv.ruyi@zte.com.cnSigned-off-by: default avatarWei Liu <wei.liu@kernel.org>
parent 0b906085
......@@ -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++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment