Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752751AbbKYXqz (ORCPT ); Wed, 25 Nov 2015 18:46:55 -0500 Received: from relmlor3.renesas.com ([210.160.252.173]:53476 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751916AbbKYXqw (ORCPT ); Wed, 25 Nov 2015 18:46:52 -0500 X-IronPort-AV: E=Sophos;i="5.20,344,1444662000"; d="scan'";a="200543495" Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Message-ID: <8737vtejg6.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: LABBE Corentin CC: , , , , , Subject: Re: [PATCH] ASoC: rsnd: fix a possible NULL dereference In-Reply-To: <1448455796-27315-1-git-send-email-clabbe.montjoie@gmail.com> References: <1448455796-27315-1-git-send-email-clabbe.montjoie@gmail.com> User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="US-ASCII" Date: Wed, 25 Nov 2015 23:46:45 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR06CA0039.apcprd06.prod.outlook.com (25.164.91.49) To SIXPR06MB1022.apcprd06.prod.outlook.com (25.160.239.156) X-Microsoft-Exchange-Diagnostics: 1;SIXPR06MB1022;2:dwCT8nL1UBBJOFjk9b0nn2ayDJu+lkxI4aQsMslBDPZI8UZyHrlqf7rXD36li6xbyio7c3hirweB1JD2NG/5tpkmfBhirhAcuc+5MyYZiGgRXBRw39VpmZxtXufyV7oSsunkb1zv3Y4bpidGA4X+Xg==;3:RBtg9k5IN7x2znlkDVlzrUHNQCUwQJoLDPyfIFRsG1059VrXA6W/tjk0jW0cz0Ji7fNQTZDfR5X+v0jbgCcO73VxqKRBadtwlsE4cT/8iePSbhbwzhFG9kt2IYABjmCt;25:81nYPUx+G6hUF9acEoEfBAOjJK/YrbY11b9lFog/BEUsQfxFXsN75JwnBk9TQKjBWA/o/eooo6HA5M90llDqAVF60X0c5cT6KB3+TBNMgB4dXpnib+DN7MVx9Sci2i0VQ6ihK6G5hObb5VV3VBxRmCnFC7KGtds7dLg9eNhEBnjycxKsjrcw1mSAI8PdldlcDuhrzXuTsgzS7ujhiHT9yHURuKs/BRSH2KsoXwxJ6dTdCigEAO7jd9F2tJ+1yWNCdFLZiN2eJq8zkEaAIO1aoA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SIXPR06MB1022; X-Microsoft-Exchange-Diagnostics: 1;SIXPR06MB1022;20:aF5TLG02JIuztxoBOIjGd8K66A5DPUbQEW51cGz+P/UeffeTz2so80uDnCFcf2TjB9haXaiBZQpeHcpyIgzRo/KN33cbWL7m5/vZdn3HWtesAtTEraZeTsfkIl2AEOlLW1oMobhZ3I1Iz5V/erV7NUWFnWmUxh2o33k2hs1YiXIaK782jsh5OQPrmQrE//Bg++qOC5XNHNQrKWScAWRcpGGijoRlimp747ViPDIPWQPlWwgNX+ceI3dxBKu02U4hM5AytMojbfLz/B9rnzlfT5oy+vmu4B9sBULCQWmEvWiCxnkibbE8Z8sH/NTRJqKK5/7SV21iOExUQgrlqmcUyq8B0FjNcDj1eawDIXfr45tMxLNOrKZT1dGbJl497hwoApud4Kqh/e8QEWBFXurmIQmkuMo5f3VCMo1AE059CgVBf0cO1aG5DWE4s5o3Qt6HiZdAPFAbHd/1rO1SAPIIC2l/tnZnw16PMModBNWu5jbS22WbFErnhaBZ4yjnBC58;4:nkIXTHj6wT03F9FrAzENuN9StLsvTGCM7UGjK/9LyV0HoBwAhS2Gl6IceyijZUz9kE/rE/MUarHEtIShA9yJW251kyua3miGf+YEpTRBV1sX8Fm30ndb66t95dxfUQf5jptADe3V2DRH1I7p0kp3dYqJrU8a2eAZX48RzNa1nD+eJW0Vd8W3/vtBtjpbArut13ZtfaofalmGGCZJEAvS7yZd+A14OPhKa9MMRfT3uTXPuzzAuFz+v0b8ItYysooqJApDGYEjD7WGtRlbKkRQO6DAa1/+AVx31ly2GZ+ekTsb+klTPtlsTW3kt9q1hVrkFswI1+OlrPDp2XxqlzHun40A6zDe1usIZxyEOkU2h2J4Ipx/had7XO1bTzs4QuyQ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(10201501046);SRVR:SIXPR06MB1022;BCL:0;PCL:0;RULEID:;SRVR:SIXPR06MB1022; X-Forefront-PRVS: 0771670921 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(189002)(199003)(46406003)(47776003)(77096005)(2950100001)(105586002)(106356001)(189998001)(36756003)(53416004)(97736004)(1096002)(66066001)(83506001)(50466002)(101416001)(42186005)(110136002)(81156007)(40100003)(4001350100001)(6116002)(5001960100002)(23726003)(86362001)(19580395003)(87976001)(5008740100001)(5004730100002)(92566002)(33646002)(3846002)(76176999)(19580405001)(54356999)(122386002)(69596002)(50986999)(586003);DIR:OUT;SFP:1102;SCL:1;SRVR:SIXPR06MB1022;H:morimoto-PC.renesas.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SIXPR06MB1022;23:gVWoa3Cl11vj5Ql4JNDSewDpIDEfPvRvxQMQLe8UD?= =?us-ascii?Q?Tnhp4KlNMV1U1ZT+jXtArhDWNf6OYXXGoW/ZyqyzKbMGs2iO7ANz+qEu5vj6?= =?us-ascii?Q?SIbkuW2rBBIr+aVktGdzx/i5+V2Ytv+Idc3Zy4cNsFiBRkg2pgpRpfxpVzaT?= =?us-ascii?Q?WSOD5fkYdXbbg7dQsv7/91hRBsYIskWWLE7GITcnJnedJBMwVkoEbvfQkztE?= =?us-ascii?Q?Pn+SOUEjitqi5AdJt03Q0HnUoObBcpU0Foj0DyJXj5BlmV4qre5Wn/0O/hw+?= =?us-ascii?Q?Ph6p2oxX5Hv3keiVBlIE717d9usgVhQBGem/AXj474P9L536Jq9KWBxsaFcD?= =?us-ascii?Q?txvBqtzcLUGN3vsM9QpmHoV3SrJBvpZMPc0NUJlGy4TO/tJG0A49B4AzZUeS?= =?us-ascii?Q?IGvdoaFjCog9R7nTfIeS2SoRBQMRN7bmPQKDZpIclk89MMdyDrG0G+oanhmh?= =?us-ascii?Q?gneErFlJ0XcZlhFky3wxXyxQKJTAYOUkhuqj1fOpDlWT6NnTsgcHDNn62+y3?= =?us-ascii?Q?g3gQJOm6mrvu54RLPxuCLXslQbMGN4lBbgvYVWt+FfR2rpvuh0W5inkgBtyd?= =?us-ascii?Q?QjMwT+nKVUPd3EEsxcRUN3gdTB8j5dsIwr3aXrAxPnCPfb2qLQrYw7OC8GM/?= =?us-ascii?Q?/ZoObVpkAlbjVcrtaBuw/6g08u8MxEI5kSRzkKbfgg/LnRztkpORvkdMJp3h?= =?us-ascii?Q?O904a1QUaEkL4ucfi/owvZIlxx+XSIEiCqYxUq/5thOy01QotVicNm+vr8hd?= =?us-ascii?Q?o6FPjVSypV57BEEGhmt02x9ik2jHVZYieGai83XZzJujAzkDKN9QfM96KnSe?= =?us-ascii?Q?zIywZXiBT3T7XO1MhsyfCS5i9AHSOE6YNds5GTslFzP0RG8UoKziXZ6bXTbg?= =?us-ascii?Q?O8KZqLi/nOK6WrNSV2IGcd8ZzMShXDYBEWmlsPPbqwL5z7DybOf2LzgWnUXB?= =?us-ascii?Q?p8sL+paoyxXhUwtVpD8cwPC37YtKTrSUaE8G9SNt9gpBwVV1uq+A4C9Ke9kE?= =?us-ascii?Q?HK8w+AZgmz/py3b9kcWF9EKkWT1LjKKzKw02OyzodVTbFSoN4R+RSgNKxntk?= =?us-ascii?Q?hXlrMFliEk67xMMyNV4DIc0fTgn?= X-Microsoft-Exchange-Diagnostics: 1;SIXPR06MB1022;5:45/F6k4j7rxPj0CYTOPJL6J0RETSZbfZ7vxvXum4C1aFFFKp+Jl/E2Jd93RzEOyqbvPnUmupk6+UKp/nehftzRahtxykB0ZR6Wo+KklVAzEx2sun0+lIu65HNFqtFuW1RcBlUhqgK6hrxLwIe+jGwA==;24:uG/GzHvZ8Cvg+OZgaZRhg5yDXW2jchzPz8VRH245AAtzJOquPaUFaJwX1X/oe/U47KXg4zCmYl5TBr1DPBHPc30i0QUE6g9x4lte8APq83c=;20:VgLOYnRpSUrMVZjInmJ3m6FiV+/fXNKppoel6pxJaw7yA/yBan11XsldSrn5O7h2nWmOYw5rmSNKwYhNhx7lczB/4IDVFu0HMzyVR5qCkaL4krex9rS6OeA6bqDiJrNCWQSmZMd85zZTjg61U1WHYHGUppwpeKfKb/aOgRsILVo= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Nov 2015 23:46:45.8750 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SIXPR06MB1022 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1463 Lines: 44 Hi LABBE Thank you for your patch > of_match_device could return NULL, and so cause a NULL pointer > dereference later. > Even if the probability of this case is very low, fixing it made > static analyzers happy. > Solving this with of_device_get_match_data made also code simplier. > > Signed-off-by: LABBE Corentin > --- > sound/soc/sh/rcar/core.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c > index deed48e..54cc44c 100644 > --- a/sound/soc/sh/rcar/core.c > +++ b/sound/soc/sh/rcar/core.c > @@ -1204,7 +1204,6 @@ static int rsnd_probe(struct platform_device *pdev) > struct rsnd_priv *priv; > struct device *dev = &pdev->dev; > struct rsnd_dai *rdai; > - const struct of_device_id *of_id = of_match_device(rsnd_of_match, dev); > const struct rsnd_of_data *of_data; > int (*probe_func[])(struct platform_device *pdev, > const struct rsnd_of_data *of_data, > @@ -1221,11 +1220,13 @@ static int rsnd_probe(struct platform_device *pdev) > }; > int ret, i; > > + of_data = of_device_get_match_data(dev); > + if (!of_data) > + return 1; return 1 ? You want to use -EINVAL ? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/