From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CB05C4338F for ; Tue, 10 Aug 2021 13:03:30 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2E9006024A for ; Tue, 10 Aug 2021 13:03:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2E9006024A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PBS17SSDSKQ7jGAh9BDMNHVtnlI2Y2rhuUekWItU9Ng=; b=kjlNszfW5o2a6R K3Kj8/g8v1giyGr1LZaXEqVPaDQikvEvA5SFb11yYWXcy+dsFsWXSBz2UfKh8w+SUTQep9UL5R91a 3gKDmxRPyC/azlOZm19l6eiH2mWmIk7eS1jIwI7mmKG8jj6mBLe0uREV/vIkcduf7osX+PR9/PXiQ VBk6A55tNcs6e/PRhNvtoYsVv6IcjXXLV39H6m5lZlyVK00EE5tQjsZA+xrhAhMV+wO0ghC/CEAlg nXZoyemUygb/KQFc9F/Tt89wjCn3TjsCbgdtP7P80wtX6Ixmt9Ja/bm4V3HSK3vvTouNWIgJbuLa7 IrRHnJoUgTX45ma6W0zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDRMg-003puB-Id; Tue, 10 Aug 2021 13:00:20 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDRBQ-003mtN-Gy for linux-arm-kernel@lists.infradead.org; Tue, 10 Aug 2021 12:48:44 +0000 Received: by mail-lj1-x22a.google.com with SMTP id y7so17904339ljp.3 for ; Tue, 10 Aug 2021 05:48:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vrcMLWtfOeCXSMGpjMYNY3zEn4WCrRn/aqSB39sMZio=; b=eD3vQDsassz7bEN0mNbQhZAijheRKwqU+oK96s9ut4efsxy/pfcMMgLfN/39mBcNzA CWcAVe/mxoYkiw5lw9HAubl20qZcNVos3RgWK1m2BARdzZAuLzG/CDkcJg/YoPg6pxSO 6pWektyrqQeFMs+3mYXfOkCXNiN4k44T+Av9Xfx5y9PLMvke9N7nIVdxG7ov3uqszD0G s+pKlKviR2OdDnoh4hi918VXhjTAb4W2zC/pe4xpQmBAlIe5/uu0nqio9njHt6C5sx0A nTPOCui2hn2g9N2pRraqtmMEHWvGpHUdOCSzjrh2QSS7U+ahTai2W/biKy52JtUBdbgL rUTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vrcMLWtfOeCXSMGpjMYNY3zEn4WCrRn/aqSB39sMZio=; b=dmjkzKcL2ejTs275SkpH2+3OUfd82Bbo63NsLxRyJD2ma4Hji+DBI+cZe1RME9lerE kwVBKJR+WhJUAGUcZohQGHbzNk6MHvK5S0j4EPfCEzaBh0lFP0XQuBvB2gACs4aAJrFH T3JY7BV1A1qZg0RSH7vT8DzebGxZ7LBM8P5VcOMM7i6nMTIx4R+htwqGHW5AjNFKAhHF bzRM1PjthH7UQwYskEfL3B3sxegIU0JOP4LKkigo28cV2b/bj9yO9BjVeeynHxnkaVD9 7QC10/gs41XrRaIg+RA/IfbEaXWqwpWeC0s3SeASv8EyeInHHqnm9qtVPwOW4+phI5db CIjg== X-Gm-Message-State: AOAM532BMTu+6uuvmtmYsR073s1hR9R9w3KyFs9UsYUXaoc0BQnwbpEH ibh1dtackWcL7aK1M4mYiZsvG7OxR2gjIbbuAz0tIw== X-Google-Smtp-Source: ABdhPJyLep687DdIq4Uf7xmhfsYa46ZEV2mhNzCv+q7NsAgri4IdNPReJB6X5A+3utEOR+kjh7KGMkjlhyQd0vAmS5A= X-Received: by 2002:a2e:a231:: with SMTP id i17mr9037133ljm.467.1628599717797; Tue, 10 Aug 2021 05:48:37 -0700 (PDT) MIME-Version: 1.0 References: <20210725180830.250218-1-maz@kernel.org> In-Reply-To: <20210725180830.250218-1-maz@kernel.org> From: Linus Walleij Date: Tue, 10 Aug 2021 14:48:26 +0200 Message-ID: Subject: Re: [PATCH] pinctrl: stmfx: Fix hazardous u8[] to unsigned long cast To: Marc Zyngier Cc: Linux ARM , linux-kernel , Android Kernel Team , stable , Amelie Delaunay , Maxime Coquelin , Alexandre Torgue X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210810_054840_655065_6C4D275F X-CRM114-Status: GOOD ( 13.85 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, Jul 25, 2021 at 8:08 PM Marc Zyngier wrote: > Casting a small array of u8 to an unsigned long is *never* OK: > > - it does funny thing when the array size is less than that of a long, > as it accesses random places in the stack > - it makes everything even more fun with a BE kernel > > Fix this by building the unsigned long used as a bitmap byte by byte, > in a way that works across endianess and has no undefined behaviours. > > An extra BUILD_BUG_ON() catches the unlikely case where the array > would be larger than a single unsigned long. > > Fixes: 1490d9f841b1 ("pinctrl: Add STMFX GPIO expander Pinctrl/GPIO driver") > Signed-off-by: Marc Zyngier > Cc: stable@vger.kernel.org > Cc: Amelie Delaunay > Cc: Linus Walleij > Cc: Maxime Coquelin > Cc: Alexandre Torgue Patch applied! Yours, Linus Walleij _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel