提交 f8433226 编写于 作者: I Insu Yun 提交者: Mauro Carvalho Chehab

[media] cx231xx: correctly handling failed allocation

Since kmalloc can be failed in memory pressure,
if not properly handled, NULL dereference can be happend
Signed-off-by: NInsu Yun <wuninsu@gmail.com>
Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
上级 b68554cd
......@@ -1382,6 +1382,8 @@ static int cx231xx_bulk_copy(struct cx231xx *dev, struct urb *urb)
buffer_size = urb->actual_length;
buffer = kmalloc(buffer_size, GFP_ATOMIC);
if (!buffer)
return -ENOMEM;
memcpy(buffer, dma_q->ps_head, 3);
memcpy(buffer+3, p_buffer, buffer_size-3);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册