Skip to content

Commit 01ccca3

Browse files
Lv Ruyiliuw
Lv Ruyi
authored andcommitted
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 <[email protected]> Signed-off-by: Lv Ruyi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Wei Liu <[email protected]>
1 parent 0b90608 commit 01ccca3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/hv/ring_buffer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
223223
pages_wraparound = kcalloc(page_cnt * 2 - 1,
224224
sizeof(struct page *),
225225
GFP_KERNEL);
226+
if (!pages_wraparound)
227+
return -ENOMEM;
226228

227229
pages_wraparound[0] = pages;
228230
for (i = 0; i < 2 * (page_cnt - 1); i++)

0 commit comments

Comments
 (0)