[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220107014207.2761644-1-jiasheng@iscas.ac.cn>
Date: Fri, 7 Jan 2022 09:42:07 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: gregkh@...uxfoundation.org
Cc: jirislaby@...nel.org, linux-serial@...r.kernel.org,
linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: Re: Re: [PATCH] tty/serial: Check for null pointer after calling devm_ioremap
On Thu, Jan 06, 2022 at 11:01:20PM +0800, Greg KH wrote:
>> As the possible failure of the allocation, the devm_ioremap() may return
>> NULL pointer.
>
> I do not understand this sentence.
Well, since the devm_ioremap() calls devres_alloc() to allocate memory,
it may fail because of the lack of memory and return NULL pointer.
>> And the 'port->membase' will be directly used in mlb_usio_startup().
>
> This does not make sense either.
I notice that in mlb_usio_startup() 'port->membase' is used in
'escr = readb(port->membase + MLB_USIO_REG_ESCR);'
without checking whether it is NULL before, that is to say, it is directly used.
Therefore, it may cause the dereference of the NULL pointer.
>> Therefore, in order to avoid the dereference of the NULL pointer, it
>> should be better to add the sanity check.
>
> What do you mean by "sanity check"?
Since I believe that after all the allocation we need to check whether it
succeed.
So the "sanity check" means the check that lost and we need to make up to
maintain the integrity.
Moreover, I am glad for your reply.
And I will refine my commit message in next version to make it more clear.
Sincerely thanks,
Jiang
Powered by blists - more mailing lists