Skip to content

Commit

Permalink
Drivers: hv : vmbus: Adding NULL pointer check
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Lv Ruyi authored and liuw committed Oct 28, 2021
1 parent 0b90608 commit 01ccca3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/hv/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down

0 comments on commit 01ccca3

Please sign in to comment.