On 9/23/20 9:49 PM, Thomas Petazzoni wrote:
> On Wed, 23 Sep 2020 21:13:51 +0200
> Heinrich Schuchardt <[email protected]> wrote:
>
>> We should check if the incoming parameter file_mapping is not NULL instead
>> of checking after adding an offset.
>>
>> Reported-by: Coverity CID 307210
>> Signed-off-by: Heinrich Schuchardt <[email protected]>
>
> Acked-by: Thomas Petazzoni <[email protected]>
>
> However, I wonder if this check is really useful. sqfs_read_metablock()
> is an internal function, so it should be up to the callers to make sure
> that they don't pass a NULL file_mapping argument.
>
> Thomas
>

This is a question of programming style. Eliminating the check may be
justified if the input variable is checked by every caller.

The real problems are elsewhere, e.g.

sqfs_search_dir() and sqfs_readdir() do not check the return value of
sqfs_find_inode() which may be NULL.

sqfs_opendir() leaks allocated memory if an error occurs.

Best regards

Heinrich

Reply via email to