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: 13409152 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4801FE7C4EB for ; Wed, 4 Oct 2023 18:39:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=VJwyzfbi9+MYdt76UrL9M4jwttXTepaerJ0J3TvlNXI=; b=bD/N1+G2peWmjU +9kngakHWVCX4GRdrG/v6BHsS69RiZ8WWlNjZBcF1SvshhZcsjMcy3iUoPHzZBoxuxecuNbVWtTs+ yU/Bt8iX57dUXPCoqX9gqIK0iNLo/HJoNw02rXQYo9Z7nMjfxIRQsoNGknP7brJENK/fYdYK7YOXE VouYDkeG0/AtBr4jwHXG+1pN6gwBjXfc6CohCg+Fr5/aF3JqW8Y0rJp/b+ocMF5UyKOK0L8nfbczY 1GlxB9LnRjAeExvmA36BKo99Ogxr6eIFHS7ZA8iTFyzMM2qgQ9G5CJQCArSiBnv50WzrR7BuaUc/5 /skKPf5p7H2JF7yzCEvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qo6mG-000iJX-0W; Wed, 04 Oct 2023 18:39:20 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qo6mB-000iI8-2h for linux-arm-kernel@lists.infradead.org; Wed, 04 Oct 2023 18:39:18 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-307d20548adso176366f8f.0 for ; Wed, 04 Oct 2023 11:39:14 -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=lists.infradead.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=IzwgiHhlOiUOM419exqBfX5coIUzULzoPC+J70Z/EJMPBZeQSFCxDpYpMx7SW3y5FU +TY+OpJjnJO3rRh41oMSZdvfeYRH7JR/3y+EmmkPVjCKJpO7w7ejZQteSq2QRZkPdzwn Oo+2fv52pxPD4FhTKs/obWfngYaWytOizgwTo58Yfm/jCAYMhGtOYdrnWK1qivT7YO4u 20cH5zL/xdk/Jd0WJ4T6cwHh3BWhLiM+xezSxthOskRDtLl7nx/IGY3wQbWyX8n+a8v0 xiFribRZOLGE3U2m0Xt/r3LTCAk8QWvOG/Ec/nCKVLPKRzj9gRg2Q2h5GtnupKMpKvSq DGSw== 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=YLqcTuzN2+w+w18yLlWQGAW3hAlEs0K+pdWqe40Y/cE3MjWKxWqrkbvGnPxJzs47QO xgR45xVFtQtH6ct0tDAQ3VCtWMkQ2nCHYsKr/bPi46pgiejMD4uigc/Uq3ToZ8U4f3ID gM1shjSfDYhiKJDNimk01IBYgjVwbbESQ5kA28MiM5+q8JcWfh1TE4PBLPN1qlDoepPF 7/MwT1TX3PiOhdexL7h0nJe+BxQXfhnHooVk8f/hLLzAMT7vQkmwlaWRIeutTMrFOqSc XrvT/sb6vxBEW3qLo/c7BgZgQhpL7/oOTHeh5j1ajn34Bmebbgs+COKADFmZeIgJ3AuV s1yA== X-Gm-Message-State: AOJu0YzlLuwnIldG1czpPBAsb26LvYTuzNWu1fINjIf/zCPmZU/ark4N bTAxRXimoLkFrJjQYufQ1IYbCA== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231004_113915_872020_2F59490D X-CRM114-Status: GOOD ( 14.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Reviewed-by: Linus Walleij --- 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;