Message ID | 20231019173457.2445119-2-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp548548vqb; Thu, 19 Oct 2023 10:36:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFuGRutcY4BTQRvHQGFiuF/ojAKGl8vK9b37UB0LO1sHdW5Gq30z5dsdxsJ5ZIPpb4tpjQQ X-Received: by 2002:a05:6a21:7803:b0:17b:4b61:a8f7 with SMTP id be3-20020a056a21780300b0017b4b61a8f7mr3102940pzc.9.1697737001069; Thu, 19 Oct 2023 10:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697737001; cv=none; d=google.com; s=arc-20160816; b=WCBqbDpprQqs3ThcDZoqJEZU3Zt9Do29KAxvKT1wME9kBtcVbX7S66TjoUMKhGOESm VP+27iakRFxPoYQ8XeW5iZ5hNHJWCtyyPHuAFs1aEcK7LZryXY9Sh5PoRkCqmRvG9xp0 O/Je8d41tjJfjXkOdfVKhsnJH1ExN14cDbrsHnz208M8WiIXOG8SNNfeoIf3ZWGaXk8d P9ZdWxosf9lpNgrlZFXWvz0KdHN7QaxtLUoicMm0Bq/8gJlG8aadKNYU+m8fP4HErvbt GbYQXDELeHP7Ho5QslinFynLfTbBqEvJR3zij+/UaC6Go8mKNR/OFo9ZQsdcrEJ/7xqn 9weA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YMKoKR9mpYuWm1Ue6hyW2OnCpv7WG9T5uvYX281UTIk=; fh=7/omDlK7dosONq5l8CePi/uH/LZ0eAviv1Treoi9wLU=; b=DJMKlpEBtUc/rwZu/CDTJIQnPMLnbMTD5Qs8ky6h6H2KfcWyir5gZ/9y0u7h+mpWRa +SJMMuoysYAuvQPWHh7j6W74gOX2RaSaZX3ASf3XTpsOPkXhcwaNVqWGbqkxqJ3RY28D 5rFvvK4JF3/oRhcyT+56R7aiyL+zTPhuzyyT3gMV4l9CmKwYy9AlD8oWhdKKDFhaRHXU DmaZON0W1Jp1V/z1F/719vivD9/FZIqVJh+lZxzC/FANquo7D6Be8g7/ff2cylH9wdwl fzSMEsCMdg92mVa9jw+i5uBqZGbcf+ZTQAxlQ0veBZXS0iWe1NGvh2nkNo9E2a9opUnn C2xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Oc8uynhB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id v10-20020a63610a000000b005acf91427cfsi40232pgb.628.2023.10.19.10.36.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 10:36:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Oc8uynhB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 8F83D8070DAF; Thu, 19 Oct 2023 10:35:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346344AbjJSRfP (ORCPT <rfc822;a1648639935@gmail.com> + 26 others); Thu, 19 Oct 2023 13:35:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235499AbjJSRfJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 19 Oct 2023 13:35:09 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 619A7138; Thu, 19 Oct 2023 10:35:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697736906; x=1729272906; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OK+wrv+DMOQXPBESi5xHEfknrZptJg8C/cIK0m+tQ50=; b=Oc8uynhBrgzTo2ujIVSkfTn6dxW8SwfreV1tEfMYV7p0WXwm1QR6/bl8 lFIzSo9bBeM+K8Cz7dDJ7eScjN1rdclmkqjF5ToNQV7zLpeH1xOjdkKRO 2m4Ayhml04s2j2qpBRdd6BWE+I/XC1uxspe0F45SVEjlbLi/ZK4pbCv2y 1dCaHwvalGBNWtSPOIs588KJIJVff5ZZ2uiZGvMYhH3CAgTCL53gpdIx6 wmKyVX/R7O0v4AetmQoT6hYQ8CViftb+VvW4pilX2N8k0uVZGNegvmUj/ XX8BE7w72RlbtDnWC4fKsZrHdku0qMrFS3iAyVI+c4GDEPI9JTYxi7jHr w==; X-IronPort-AV: E=McAfee;i="6600,9927,10868"; a="389184246" X-IronPort-AV: E=Sophos;i="6.03,237,1694761200"; d="scan'208";a="389184246" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2023 10:35:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10868"; a="760723566" X-IronPort-AV: E=Sophos;i="6.03,237,1694761200"; d="scan'208";a="760723566" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 19 Oct 2023 10:35:02 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 47B19F4; Thu, 19 Oct 2023 20:35:01 +0300 (EEST) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Dmitry Torokhov <dmitry.torokhov@gmail.com>, Bartosz Golaszewski <bartosz.golaszewski@linaro.org>, Linus Walleij <linus.walleij@linaro.org>, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg <mika.westerberg@linux.intel.com>, Bartosz Golaszewski <brgl@bgdev.pl>, Hans de Goede <hdegoede@redhat.com>, Ferry Toth <ftoth@exalondelft.nl> Subject: [PATCH v1 1/3] gpiolib: acpi: Add missing memset(0) to acpi_get_gpiod_from_data() Date: Thu, 19 Oct 2023 20:34:55 +0300 Message-Id: <20231019173457.2445119-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20231019173457.2445119-1-andriy.shevchenko@linux.intel.com> References: <20231019173457.2445119-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 19 Oct 2023 10:35:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780206273706603833 X-GMAIL-MSGID: 1780206273706603833 |
Series |
gpiolib: acpi: More fixes to the consolidation rework
|
|
Commit Message
Andy Shevchenko
Oct. 19, 2023, 5:34 p.m. UTC
When refactoring the acpi_get_gpiod_from_data() the change missed
cleaning up the variable on stack. Add missing memset().
Reported-by: Ferry Toth <ftoth@exalondelft.nl>
Fixes: 16ba046e86e9 ("gpiolib: acpi: teach acpi_find_gpio() to handle data-only nodes")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpiolib-acpi.c | 1 +
1 file changed, 1 insertion(+)
Comments
On Thu, Oct 19, 2023 at 08:34:55PM +0300, Andy Shevchenko wrote: > When refactoring the acpi_get_gpiod_from_data() the change missed > cleaning up the variable on stack. Add missing memset(). > > Reported-by: Ferry Toth <ftoth@exalondelft.nl> > Fixes: 16ba046e86e9 ("gpiolib: acpi: teach acpi_find_gpio() to handle data-only nodes") > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Although I think it would be better to change acpi_gpio_resource_lookup() to take an index and return a gpiod descriptor and have a local copy of the lookup structure. > --- > drivers/gpio/gpiolib-acpi.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c > index fbda452fb4d6..51e41676de0b 100644 > --- a/drivers/gpio/gpiolib-acpi.c > +++ b/drivers/gpio/gpiolib-acpi.c > @@ -951,6 +951,7 @@ static struct gpio_desc *acpi_get_gpiod_from_data(struct fwnode_handle *fwnode, > if (!propname) > return ERR_PTR(-EINVAL); > > + memset(&lookup, 0, sizeof(lookup)); > lookup.index = index; > > ret = acpi_gpio_property_lookup(fwnode, propname, index, &lookup); > -- > 2.40.0.1.gaa8946217a0b > Thanks.
On Thu, Oct 19, 2023 at 9:20 PM Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > > On Thu, Oct 19, 2023 at 08:34:55PM +0300, Andy Shevchenko wrote: > > When refactoring the acpi_get_gpiod_from_data() the change missed > > cleaning up the variable on stack. Add missing memset(). > > > > Reported-by: Ferry Toth <ftoth@exalondelft.nl> > > Fixes: 16ba046e86e9 ("gpiolib: acpi: teach acpi_find_gpio() to handle data-only nodes") > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> > > Although I think it would be better to change > acpi_gpio_resource_lookup() to take an index and return a gpiod > descriptor and have a local copy of the lookup structure. > I queued it for fixes as this is a bug, we can improve it later. Bart > > --- > > drivers/gpio/gpiolib-acpi.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c > > index fbda452fb4d6..51e41676de0b 100644 > > --- a/drivers/gpio/gpiolib-acpi.c > > +++ b/drivers/gpio/gpiolib-acpi.c > > @@ -951,6 +951,7 @@ static struct gpio_desc *acpi_get_gpiod_from_data(struct fwnode_handle *fwnode, > > if (!propname) > > return ERR_PTR(-EINVAL); > > > > + memset(&lookup, 0, sizeof(lookup)); > > lookup.index = index; > > > > ret = acpi_gpio_property_lookup(fwnode, propname, index, &lookup); > > -- > > 2.40.0.1.gaa8946217a0b > > > > Thanks. > > -- > Dmitry
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index fbda452fb4d6..51e41676de0b 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -951,6 +951,7 @@ static struct gpio_desc *acpi_get_gpiod_from_data(struct fwnode_handle *fwnode, if (!propname) return ERR_PTR(-EINVAL); + memset(&lookup, 0, sizeof(lookup)); lookup.index = index; ret = acpi_gpio_property_lookup(fwnode, propname, index, &lookup);