From patchwork Wed Oct 4 18:39:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 729398 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06F15E7C4E9 for ; Wed, 4 Oct 2023 18:39:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243812AbjJDSjT (ORCPT ); Wed, 4 Oct 2023 14:39:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243633AbjJDSjT (ORCPT ); Wed, 4 Oct 2023 14:39:19 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33700C9 for ; Wed, 4 Oct 2023 11:39:15 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3247cefa13aso162341f8f.1 for ; Wed, 04 Oct 2023 11:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1696444753; x=1697049553; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QA+Y3LssOPJ3KAADHkTgfkM+4lfsQSRUByKy5qehR+I=; b=l0c7FjqSkm9u34rUPxY50qEdwFtPVWe0pfCN73L/g90h14reeFXkfq3V3kq6XpAFN4 Xh264Z3qgcHbFveEmK7lTjC2G54+t63+iCtOQV8zdSnZFX9ZVr3QxPfNSetxah0l/nTK Pl0anrgN+hkecZNIoPP4WKa6MMM4nBOiaAG6k2CfmbFroaFlUhGRFCSWCgLXjNcUxddi vUu/++ICtomys5urCSyWUQgsJ1u95bkvSJUfa2mwo5+F+8+aR+6NgK7HAs7XwDZt/5mJ ejQ0QfZ+IqV+9fCZXCL8QQ4VyVPXhNCoq0WPQR4rwnXRKfYZd3OElvzs57nFRuz1L9je sqqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696444753; x=1697049553; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QA+Y3LssOPJ3KAADHkTgfkM+4lfsQSRUByKy5qehR+I=; b=J1VjbWWiw44Fjm795LYiXQXrtxmVMktX3iWKjfZNWkUj+mggpJBQs8lSaUFlaTm6VR eiO9ZrAT5NP31B+e/aBwcrmMciz/3tXmCkqR4ri81yQe0+6+cln9+aOgtOZw4EPFC9FI c74Y4aWsEtr/+IBVC6pFIoeGdphArse3RPeGLdhUbblHWz4Zf7Ri1LEejjLxxTS/Wms/ jWcVZW1q8bZTyL483dU0qiOHhjkonFyTN7evTGr3osCK/Lx9hfZa4H4Pv+8ilTtru0Et zrdPKmCTXY+7pYIlu98Noty54dYo/2yKH1DNM89srlhILMUBOyVJlsMnqX9PeW5eYZEd SZdQ== X-Gm-Message-State: AOJu0Yxnb5sHJgavifv40H7NqEtfaYI1OPX6KowakIeimGQ5UcjVfmAt AjHPb4/HQQ0kTbwPtdpZOwsyDA== X-Google-Smtp-Source: AGHT+IFHrJt9Llwwm5JxoO+o1/3XuyhHZP01x1HpnwvYcsCqaaDIXZfPsR/EwAiRfDvwXntresVquA== X-Received: by 2002:adf:fdd0:0:b0:321:6fe4:d4eb with SMTP id i16-20020adffdd0000000b003216fe4d4ebmr2878576wrs.2.1696444753110; Wed, 04 Oct 2023 11:39:13 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:4cd6:4440:32bb:f50d]) by smtp.gmail.com with ESMTPSA id s21-20020a7bc395000000b004064cd71aa8sm2109950wmj.34.2023.10.04.11.39.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 11:39:12 -0700 (PDT) From: Bartosz Golaszewski To: Mark Brown , Florian Fainelli , Andy Shevchenko , Linus Walleij , Ray Jui , Scott Branden Cc: Broadcom internal kernel review list , linux-spi@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Bartosz Golaszewski , Hans de Goede Subject: [PATCH] spi: bcm2835: add a sentinel at the end of the lookup array Date: Wed, 4 Oct 2023 20:39:06 +0200 Message-Id: <20231004183906.97845-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Bartosz Golaszewski GPIOLIB expects the array of lookup entries to be terminated with an empty member. We need to increase the size of the variable length array in the lookup table by 1. Fixes: 21f252cd29f0 ("spi: bcm2835: reduce the abuse of the GPIO API") Reported-by: Hans de Goede Closes: https://lore.kernel.org/lkml/29764d46-8d3d-9794-bbde-d7928a91cbb5@redhat.com/ Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko --- drivers/spi/spi-bcm2835.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index c9078fee3662..e709887eb2a9 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -1299,7 +1299,7 @@ static int bcm2835_spi_setup(struct spi_device *spi) * More on the problem that it addresses: * https://www.spinics.net/lists/linux-gpio/msg36218.html */ - lookup = kzalloc(struct_size(lookup, table, 1), GFP_KERNEL); + lookup = kzalloc(struct_size(lookup, table, 2), GFP_KERNEL); if (!lookup) { ret = -ENOMEM; goto err_cleanup;