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: <683df422-68f2-12e3-ff5e-66c45e567db2@huawei.com>
Date:   Thu, 1 Dec 2022 10:09:22 +0800
From:   Qiheng Lin <linqiheng@...wei.com>
To:     AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>
CC:     <mchehab@...nel.org>, <matthias.bgg@...il.com>,
        <linux-media@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-mediatek@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] media: platform: mtk-mdp3: Fix return value check in
 mdp_probe()

在 2022/11/30 17:44, AngeloGioacchino Del Regno 写道:
> Il 30/11/22 09:13, Qiheng Lin ha scritto:
>> In case of error, the function mtk_mutex_get()
>> returns ERR_PTR() and never returns NULL. The NULL test in the
>> return value check should be replaced with IS_ERR().
>>
>> Fixes: 61890ccaefaf ("media: platform: mtk-mdp3: add MediaTek MDP3 
>> driver")
>> Signed-off-by: Qiheng Lin <linqiheng@...wei.com>
>> ---
>>   drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c 
>> b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
>> index c413e59d4286..7a2d992dd842 100644
>> --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
>> +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
>> @@ -207,8 +207,8 @@ static int mdp_probe(struct platform_device *pdev)
>>       }
>>       for (i = 0; i < MDP_PIPE_MAX; i++) {
>>           mdp->mdp_mutex[i] = mtk_mutex_get(&mm_pdev->dev);
>> -        if (!mdp->mdp_mutex[i]) {
>> -            ret = -ENODEV;
>> +        if (IS_ERR(mdp->mdp_mutex[i])) {
>> +            ret = PTR_ERR(mdp->mdp_mutex[i]);
>>               goto err_return;
>>           }
>>       }
>>
> 
> That's true, and I fully agree.
> While you're at it, can you also fix the err_return case?
> 
> if (mdp)
>      for ...
>          if (!IS_ERR_OR_NULL(mdp->mdp_mutex[i]))
>              mtk_mutex_put(...)
> 

Thanks for your suggestion, will send the v2.

> Thanks,
> Angelo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ