Re: [PATCH] drivers: staging: greybus: fix GPF issue in gb_camera_capture

From: Dongliang Mu
Date: Thu May 04 2023 - 11:09:58 EST



On 5/4/23 PM10:53, Dan Carpenter wrote:
On Thu, May 04, 2023 at 09:58:41PM +0800, Dongliang Mu wrote:
In gb_camera_capture(), it does not check the value of settings
before dereferencing it. And gb_camera_debugfs_capture calls
gb_camera_capture with the 6th parameter settings as NULL.

Fix this by checking the value of setting at the starting of
gb_camera_capture.

Fixes: 3265edaf0d70 ("greybus: Add driver for the camera class protocol")
Signed-off-by: Dongliang Mu <dzm91@xxxxxxxxxxx>
---
No. The original code is correct. memcpy(p, NULL, 0); is allowed.

Oh, I see. This memcpy with src as NULL and len as zero is intended.

Thanks, Dan.

Sorry for the false alarm, guys.

I don't see a bug.

regards,
dan carpenter