lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <680d83a5-22fa-4851-b82d-ca59b67c5ad2@hust.edu.cn>
Date:   Tue, 30 May 2023 09:11:55 +0800
From:   Dongliang Mu <dzm91@...t.edu.cn>
To:     Hans de Goede <hdegoede@...hat.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     linux-media@...r.kernel.org, linux-staging@...ts.linux.dev,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: atomisp: move the sanity checks before variable
 dereferences



On 5/29/23 23:46, Hans de Goede wrote:
> Hi,
> 
> On 5/29/23 17:21, Dongliang Mu wrote:
>> Smatch reports:
>>
>> sh_css_load_firmware() warn: variable dereferenced before check 'fw_data'
>>
>> The variable fw_data can be NULL in sh_css_load_firmware, resulting in
>> NULL pointer dereference.
>>
>> Fix this by moving the sanity checks before variable dereferences.
>>
>> Signed-off-by: Dongliang Mu <dzm91@...t.edu.cn>
> 
> Thank you for your patch, but the same patch has already been submitted
> and merged into my media-atomisp branch about a week ago:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/hansg/linux.git/commit/?h=media-atomisp&id=c09907049eea9f12e959fb88c02a483a4c5eee89

I see. Thanks for your reply.

> 
>> ---
>>   drivers/staging/media/atomisp/pci/sh_css_firmware.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/media/atomisp/pci/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/sh_css_firmware.c
>> index e7ef578db8ab..38b757c3df0a 100644
>> --- a/drivers/staging/media/atomisp/pci/sh_css_firmware.c
>> +++ b/drivers/staging/media/atomisp/pci/sh_css_firmware.c
>> @@ -229,6 +229,10 @@ sh_css_load_firmware(struct device *dev, const char *fw_data,
>>   	struct sh_css_fw_bi_file_h *file_header;
>>   	int ret;
>>   
>> +	/* some sanity checks */
>> +	if (!fw_data || fw_size < sizeof(struct sh_css_fw_bi_file_h))
>> +		return -EINVAL;
>> +
>>   	firmware_header = (struct firmware_header *)fw_data;
>>   	file_header = &firmware_header->file_header;
>>   	binaries = &firmware_header->binary_header;
>> @@ -243,10 +247,6 @@ sh_css_load_firmware(struct device *dev, const char *fw_data,
>>   		IA_CSS_LOG("successfully load firmware version %s", release_version);
>>   	}
>>   
>> -	/* some sanity checks */
>> -	if (!fw_data || fw_size < sizeof(struct sh_css_fw_bi_file_h))
>> -		return -EINVAL;
>> -
>>   	if (file_header->h_size != sizeof(struct sh_css_fw_bi_file_h))
>>   		return -EINVAL;
>>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ