From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752710AbeC0NnH (ORCPT ); Tue, 27 Mar 2018 09:43:07 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:41711 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752457AbeC0NnG (ORCPT ); Tue, 27 Mar 2018 09:43:06 -0400 X-Google-Smtp-Source: AG47ELtTTlzbQ816XwI6wjy436zJP1c9Vgg83AN/Uoe/6AtSoV5U3HeErMEc5+IsvuuxV8PUSwDgU+njBuMMh0aX+Ek= MIME-Version: 1.0 In-Reply-To: <1521934848-5674-1-git-send-email-albeu@free.fr> References: <1521934848-5674-1-git-send-email-albeu@free.fr> From: Linus Walleij Date: Tue, 27 Mar 2018 15:43:00 +0200 Message-ID: Subject: Re: [PATCH v2] gpio: ath79: Fix potential NULL dereference in ath79_gpio_probe() To: Alban Bedel Cc: "open list:GPIO SUBSYSTEM" , Wei Yongjun , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 25, 2018 at 12:40 AM, Alban Bedel wrote: > From: Wei Yongjun > > platform_get_resource() may return NULL, add proper > check to avoid potential NULL dereferencing. > > This is detected by Coccinelle semantic patch. > > @@ > expression pdev, res, n, t, e, e1, e2; > @@ > > res = platform_get_resource(pdev, t, n); > + if (!res) > + return -EINVAL; > ... when != res == NULL > e = devm_ioremap(e1, res->start, e2); > > Signed-off-by: Wei Yongjun > [albeu@free.fr: Fixed patch to apply on current tree] > Signed-off-by: Alban Bedel Patch applied. Yours, Linus Walleij