[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALU4DmqEF4qbWdz5E6wo_XrWXKpYNfCzTrENCj2jH=DaZOzftQ@mail.gmail.com>
Date: Sun, 21 Sep 2025 23:22:00 -0700
From: Rui Qi <qirui.001@...edance.com>
To: "Zhuo, Qiuxu" <qiuxu.zhuo@...el.com>, "Luck, Tony" <tony.luck@...el.com>,
"bp@...en8.de" <bp@...en8.de>, "mchehab@...nel.org" <mchehab@...nel.org>,
"james.morse@....com" <james.morse@....com>, "rric@...nel.org" <rric@...nel.org>
Cc: "linux-edac@...r.kernel.org" <linux-edac@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [External] RE: [PATCH] EDAC/skx_common: Fix allocation check when
adxl_component_count is 0
On 9/19/25 8:56 PM, Zhuo, Qiuxu wrote:
> Hi Rui Qi,
>
> Thanks for looking at the code.
>
>> From: Rui Qi <qirui.001@...edance.com>
>> [...]
>> Subject: [PATCH] EDAC/skx_common: Fix allocation check when
>> adxl_component_count is 0
>>
>> From: Rui Qi <qirui.001@...edance.com>
>>
>> Use ZERO_OR_NULL_PTR instead of simple NULL check to properly handle the
>> case where adxl_component_count is 0, which would result in kcalloc
>> returning ZERO_SIZE_PTR rather than NULL.
>>
>> This ensures correct error handling when no ADXL components are present
>> and prevents potential issues with zero-sized allocations.
>
> If the ADXL component names are empty, skx_adxl_get() will immediately jump to error handling.
> So, the adxl_component_count value is guaranteed to be non-zero when passed to kcalloc().
>
Well, I've rechecked the code, and your statement is correct. So my
modification is indeed unnecessary.
>>
>> Signed-off-by: Rui Qi <qirui.001@...edance.com>
>> [...]
Powered by blists - more mailing lists