Skip to contentSkip to conversation

media: uvcvideo: Modified uvc_ctrl_fill_xu_info 'kmalloc' to 'kzalloc'

RFC PATCH New Jerry Liu 1 participant 1 message Aug 23, 2023

Subsystems (2)
lore
Share & tools
lore

Jerry Liu

author
#0 lore raw

RFC PATCH 1/1 media: uvcvideo: Modified uvc_ctrl_fill_xu_info 'kmalloc' to 'kzalloc'

If the length of UVC XU Control is 1 (even though this is illegal), due to the non-zero value of data, UVC_GET_LEN could potentially result in a length that is not 1. In order to ensure that 2-byte data array is set to 0, 'kmalloc' is modified to 'kzalloc'.

---
 drivers/media/usb/uvc/uvc_ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_ctrl.c +1 -1
index 5e9d3da862dd..054bc14f7a58 100644
@@ -2088,7 +2088,7 @@ static int uvc_ctrl_fill_xu_info(struct uvc_device *dev,
 	u8 *data;
 	int ret;
 
-	data = kmalloc(2, GFP_KERNEL);
+	data = kzalloc(2, GFP_KERNEL);
 	if (data == NULL)
 		return -ENOMEM;
 
Signature · 1 line
2.25.1