Re: [PATCH] platform/x86: panasonic-laptop: fix NULL dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/29/24 1:20 AM, Maxim Korotkov wrote:
> Hi,
> On 29.03.2024 03:21, Armin Wolf wrote:
>>> Added a pointer check to ensure that it is valid
>>> before using it for pcc initialization.
>>
>> Hi,
>>
>> is this check even needed? I think the ACPI driver core takes care
>> of passing a valid ACPI device pointer to acpi_pcc_hotkey_remove().
>>
>> Thanks,
>> Armin Wolf
>
> I proceeded from the assumption that the current check was not redundant.
> Kuppuswamy correctly noted in the message that the device would most likely be valid for the function of removal.
>
> However, in my opinion, checking for NULL is a good coding practice, and has now been implemented incorrectly in this case.
>
> Eliminating NULL checks could potentially cause bugs in this context.

Usually such checks are added when dealing with input that can change dynamically (like user input).

Since, as per the current usage, there is no chance for this device to be NULL, I don't think we need it.

>
> Best regards, Max

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer





[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux