Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1544780

Re: [v3] net: ethernet: cavium: octeon: octeon_mgmt: Handle return NULL error from devm_ioremap

From David Daney <ddaney.cavm@gmail.com>
Newsgroups linux.kernel
Subject Re: [v3] net: ethernet: cavium: octeon: octeon_mgmt: Handle return NULL error from devm_ioremap
Date 2016-12-19 22:40 +0100
Message-ID <sQdP3-4P4-17@gated-at.bofh.it> (permalink)
References <sOn69-2mQ-1@gated-at.bofh.it> <sQ8FH-1Hm-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 12/19/2016 08:04 AM, David Miller wrote:
> From: Arvind Yadav <arvind.yadav.cs@gmail.com>
> Date: Thu, 15 Dec 2016 00:33:30 +0530
>
>> Here, If devm_ioremap will fail. It will return NULL.
>> Kernel can run into a NULL-pointer dereference.
>> This error check will avoid NULL pointer dereference.
>>
>> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
>
> Since ioremap() is in fact designed to possibly fail, we do
> need to always check it's return value.  So this change is
> correct and I have applied it to the 'net' tree.

Yes, I think that is fine, although I have not tested the patch.

In general I like to know if a patch fixes a problem that has occurred 
on a platform used by the patch author, or if the author just noticed an 
issue through code inspection or automated tool for a platform that they 
cannot test on.

This patch appears to fall into the second category, but attempts to 
determine this for sure were for the most part unsuccessful.

With respect to ioremap(), in general I agree that it is designed to 
possibly fail.  For mips64 however, I think the implementation can never 
fail.  Certainly testing for failure fits better with what we expect to 
see in Linux kernel code.


>
> Thanks.
>

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[v3] net: ethernet: cavium: octeon: octeon_mgmt: Handle return NULL error from devm_ioremap Arvind Yadav <arvind.yadav.cs@gmail.com> - 2016-12-14 20:10 +0100
  Re: [v3] net: ethernet: cavium: octeon: octeon_mgmt: Handle return  NULL error from devm_ioremap arvind Yadav <arvind.yadav.cs@gmail.com> - 2016-12-15 16:10 +0100
  Re: [v3] net: ethernet: cavium: octeon: octeon_mgmt: Handle return  NULL error from devm_ioremap David Miller <davem@davemloft.net> - 2016-12-19 17:10 +0100
    Re: [v3] net: ethernet: cavium: octeon: octeon_mgmt: Handle return  NULL error from devm_ioremap David Daney <ddaney.cavm@gmail.com> - 2016-12-19 22:40 +0100

csiph-web