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

From: Dan Carpenter
Date: Thu May 04 2023 - 10:55:19 EST


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.

I don't see a bug.

regards,
dan carpenter