All of lore.kernel.org
 help / color / mirror / Atom feed
From: "weiyongjun (A)" <weiyongjun1@huawei.com>
To: David Lechner <david@lechnology.com>,
	Grygorii Strashko <grygorii.strashko@ti.com>,
	Andrew Lunn <andrew@lunn.ch>
Cc: "linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: re: [PATCH net-next] drivers: net: davinci_mdio: fix potential NULL dereference in davinci_mdio_probe()
Date: Tue, 28 Apr 2020 03:25:09 +0000	[thread overview]
Message-ID: <6AADFAC011213A4C87B956458587ADB419A6B43E@dggeml532-mbs.china.huawei.com> (raw)

> 
> On 4/27/20 4:40 AM, Wei Yongjun wrote:
> > platform_get_resource() may fail and return NULL, so we should better
> > check it's return value to avoid a NULL pointer dereference a bit
> > later in the code.
> >
> > This is detected by Coccinelle semantic patch.
> >
> > @@
> > expression pdev, res, n, t, e, e1, e2; @@
> >
> > res = \(platform_get_resource\|platform_get_resource_byname\)(pdev, t, n);
> > + if (!res)
> > +   return -EINVAL;
> > ... when != res == NULL
> > e = devm_ioremap(e1, res->start, e2);
> >
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> > ---
> 
> Could we use devm_platform_ioremap_resource() instead?

We cannot use devm_platform_ioremap_resource() here, see
Commit 03f66f067560 ("net: ethernet: ti: davinci_mdio: use devm_ioremap()")

Regards

WARNING: multiple messages have this Message-ID (diff)
From: "weiyongjun (A)" <weiyongjun1@huawei.com>
To: David Lechner <david@lechnology.com>,
	Grygorii Strashko <grygorii.strashko@ti.com>,
	Andrew Lunn <andrew@lunn.ch>
Cc: "linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: re: [PATCH net-next] drivers: net: davinci_mdio: fix potential NULL dereference in davinci_mdio_prob
Date: Tue, 28 Apr 2020 03:25:09 +0000	[thread overview]
Message-ID: <6AADFAC011213A4C87B956458587ADB419A6B43E@dggeml532-mbs.china.huawei.com> (raw)
In-Reply-To: <20190503111859.1023-1-weiyongjun1@huawei.com>

PiANCj4gT24gNC8yNy8yMCA0OjQwIEFNLCBXZWkgWW9uZ2p1biB3cm90ZToNCj4gPiBwbGF0Zm9y
bV9nZXRfcmVzb3VyY2UoKSBtYXkgZmFpbCBhbmQgcmV0dXJuIE5VTEwsIHNvIHdlIHNob3VsZCBi
ZXR0ZXINCj4gPiBjaGVjayBpdCdzIHJldHVybiB2YWx1ZSB0byBhdm9pZCBhIE5VTEwgcG9pbnRl
ciBkZXJlZmVyZW5jZSBhIGJpdA0KPiA+IGxhdGVyIGluIHRoZSBjb2RlLg0KPiA+DQo+ID4gVGhp
cyBpcyBkZXRlY3RlZCBieSBDb2NjaW5lbGxlIHNlbWFudGljIHBhdGNoLg0KPiA+DQo+ID4gQEAN
Cj4gPiBleHByZXNzaW9uIHBkZXYsIHJlcywgbiwgdCwgZSwgZTEsIGUyOyBAQA0KPiA+DQo+ID4g
cmVzID0gXChwbGF0Zm9ybV9nZXRfcmVzb3VyY2VcfHBsYXRmb3JtX2dldF9yZXNvdXJjZV9ieW5h
bWVcKShwZGV2LCB0LCBuKTsNCj4gPiArIGlmICghcmVzKQ0KPiA+ICsgICByZXR1cm4gLUVJTlZB
TDsNCj4gPiAuLi4gd2hlbiAhPSByZXMgPT0gTlVMTA0KPiA+IGUgPSBkZXZtX2lvcmVtYXAoZTEs
IHJlcy0+c3RhcnQsIGUyKTsNCj4gPg0KPiA+IFNpZ25lZC1vZmYtYnk6IFdlaSBZb25nanVuIDx3
ZWl5b25nanVuMUBodWF3ZWkuY29tPg0KPiA+IC0tLQ0KPiANCj4gQ291bGQgd2UgdXNlIGRldm1f
cGxhdGZvcm1faW9yZW1hcF9yZXNvdXJjZSgpIGluc3RlYWQ/DQoNCldlIGNhbm5vdCB1c2UgZGV2
bV9wbGF0Zm9ybV9pb3JlbWFwX3Jlc291cmNlKCkgaGVyZSwgc2VlDQpDb21taXQgMDNmNjZmMDY3
NTYwICgibmV0OiBldGhlcm5ldDogdGk6IGRhdmluY2lfbWRpbzogdXNlIGRldm1faW9yZW1hcCgp
IikNCg0KUmVnYXJkcw0K

             reply	other threads:[~2020-04-28  3:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28  3:25 weiyongjun (A) [this message]
2020-04-28  3:25 ` [PATCH net-next] drivers: net: davinci_mdio: fix potential NULL dereference in davinci_mdio_prob weiyongjun (A)
2020-04-28  7:30 ` [PATCH net-next] drivers: net: davinci_mdio: fix potential NULL dereference in davinci_mdio_probe() Grygorii Strashko
2020-04-28  7:30   ` [PATCH net-next] drivers: net: davinci_mdio: fix potential NULL dereference in davinci_mdio_prob Grygorii Strashko
  -- strict thread matches above, loose matches on Subject: below --
2020-04-27  9:40 [PATCH net-next] drivers: net: davinci_mdio: fix potential NULL dereference in davinci_mdio_probe() Wei Yongjun
2020-04-27  9:40 ` Wei Yongjun
2020-04-27 15:16 ` David Lechner
2019-05-03 11:18 [PATCH net-next] drivers: net: davinci_mdio: fix return value check " Wei Yongjun
2019-05-03 11:18 ` Wei Yongjun
2019-05-03 11:18 ` Wei Yongjun
2019-05-05 17:17 ` David Miller
2019-05-05 17:17   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6AADFAC011213A4C87B956458587ADB419A6B43E@dggeml532-mbs.china.huawei.com \
    --to=weiyongjun1@huawei.com \
    --cc=andrew@lunn.ch \
    --cc=david@lechnology.com \
    --cc=grygorii.strashko@ti.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.