Re: [PATCH v1] soc: bcm: Check for NULL return of devm_kzalloc()

From: Florian Fainelli
Date: Tue Apr 19 2022 - 14:36:09 EST




On 3/24/2022 1:35 AM, QintaoShen wrote:
As the potential failuer of allocation, devm_kzalloc() may return NULL.
Then the 'pd->pmb' and the follow lines of code may bring null pointer dereference.

Therefore, it is better to check the return value of devm_kzalloc() to avoid this confusion.

Signed-off-by: QintaoShen <unSimple1993@xxxxxxx>

Applied to https://github.com/Broadcom/stblinux/commits/drivers/next, thanks!

I modified your patch to have a Fixes: tag as replied, and follow Sergey's style recommendation.
--
Florian