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 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 25A21C54EBE for ; Thu, 12 Jan 2023 22:55:15 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7PjmqHeygQayU41uKl70dXP3qLXFOimTglF5VcL927k=; b=1JAF9UR/hzI154 oudlpBl3On+MUPcsEvY9JxSmLTh37SF1DDBh4i0jReRwLby6NcBHilvOU2AHx0PoUOPdXV2IW191q pTpayBb4Jh46KXlkRbdY5Wi2N8+AQAW62jqhxdz7/AwLI39era4TISNYRxSN3URl01kQaBF7PoFro 9oAK8m2ULPDOPtf4oZxazOFnu7HzmcdFw2FXqINbSlfKgdFQ9UXGzwg++l4D764aew/Y1j1eRvsHN YjhzOl4/D5NQ/92gaqVQgDLHmfFN5zcI0mXoEdbYJqGozRcnwQvqpQK//1SmOjKjImvx5lEJkFvN4 B4/LrERZlq2esryZGwlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pG6ST-00HQNP-VQ; Thu, 12 Jan 2023 22:54:06 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pG6SQ-00HQMr-MP for linux-arm-kernel@lists.infradead.org; Thu, 12 Jan 2023 22:54:04 +0000 Received: by mail-pj1-x102e.google.com with SMTP id q23-20020a17090a065700b002290913a521so2912593pje.5 for ; Thu, 12 Jan 2023 14:54:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=yQ92ABzCp6Jl5QDky7FURKc+0/452Lig7If4O1MqQzg=; b=PKyEQ52i3ol00UrT1vGbws7m4PqbNRc0gRSeV1duTeoKgk+58OhABGjiPstS9MzTvh AzhHO3nCZh0tYXjxyeJLi5AsO4vlwlaZwEk+Ab4QFUy+6NKVwSv+Yqgt5MTxn8qcKcxl 5We2FDl8IN23vtUDhG/H2rkax3wh2N4VWUf84= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=yQ92ABzCp6Jl5QDky7FURKc+0/452Lig7If4O1MqQzg=; b=FiCRcB3jDqLPnqwhN61iwDMIUcmDpGFRDnDd+7KkUxhT19Uov54kuHGjs2DEKl4QrI R/ZKyV3Q3YnhbSjXxwHTGccx+Vk94MhPMpV/tDZmx79CXiP4ChgVYHImwAnAelAOWUv6 SzvLCcZ7418qqydolcJzC1r9DYzakTjFiljz39Urtc0/hrMGIpbkh8M2pp8vwrItZDRo DEHbYS/vxxwGaH/GmyHxyWRG7XMhPnmbxAY6q+6h91LhNesEiumAvfnj0K9gqxmGGr8C sOka7C6l9pfRdQr/Z0wyGJPNAhc1yzIu6+k9b6DdtrsH2E/y03WFjkijCion0e+L8bCb 8Z/A== X-Gm-Message-State: AFqh2koxCkpxx+pUdC7zljE/wTAHEvRMsakAXoN9JKXhRjbiAxheym9z VbJJkcBcF0gyQ3/VkQOjYzDI5Q== X-Google-Smtp-Source: AMrXdXvMv8yN47H6GSFCZr5psKK8TzKaYe0YkAruHqVF2SbvjKlRhxKmgs+QSymp13hXwlB3hjshxA== X-Received: by 2002:a17:902:bc81:b0:192:bb38:c412 with SMTP id bb1-20020a170902bc8100b00192bb38c412mr43457240plb.44.1673564041886; Thu, 12 Jan 2023 14:54:01 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id ik4-20020a170902ab0400b001925d6fdfebsm3976552plb.299.2023.01.12.14.54.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 14:54:01 -0800 (PST) Date: Thu, 12 Jan 2023 14:54:00 -0800 From: Kees Cook To: Linus Walleij Cc: Krzysztof Halasa , Arnd Bergmann , "Gustavo A. R. Silva" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] ARM: ixp4xx: Replace 0-length arrays with flexible arrays Message-ID: <202301121452.14D1A95CA@keescook> References: <20230105215706.never.027-kees@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230112_145402_775837_E23FDDF2 X-CRM114-Status: GOOD ( 16.69 ) 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, Jan 08, 2023 at 12:58:37AM +0100, Linus Walleij wrote: > On Thu, Jan 5, 2023 at 10:57 PM Kees Cook wrote: > > > Zero-length arrays are deprecated[1]. Replace npe_load_firmware's > > union of 0-length arrays with flexible arrays. Detected with GCC 13, > > using -fstrict-flex-arrays=3: > > > > drivers/soc/ixp4xx/ixp4xx-npe.c: In function 'npe_load_firmware': > > drivers/soc/ixp4xx/ixp4xx-npe.c:570:60: warning: array subscript i is outside array bounds of 'u32[0]' {aka 'unsigned int[]'} [-Warray-bounds=] > > 570 | image->data[i] = swab32(image->data[i]); > > include/uapi/linux/swab.h:115:54: note: in definition of macro '__swab32' > > 115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) > > | ^ > > drivers/soc/ixp4xx/ixp4xx-npe.c:570:42: note: in expansion of macro 'swab32' > > 570 | image->data[i] = swab32(image->data[i]); > > | ^~~~~~ > > drivers/soc/ixp4xx/ixp4xx-npe.c:522:29: note: while referencing 'data' > > 522 | u32 data[0]; > > | ^~~~ > > > > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays > > > > Cc: Krzysztof Halasa > > Cc: Linus Walleij > > Cc: Arnd Bergmann > > Cc: "Gustavo A. R. Silva" > > Cc: linux-arm-kernel@lists.infradead.org > > Signed-off-by: Kees Cook > > Looks good to me: > Reviewed-by: Linus Walleij Thanks! > Do you need me to funnel this to the SoC tree or do you have > some quickpath for fixes like this? I'll take it via my tree if unless you'd rather it go through yours. Most maintainers take these directly, but some don't want to. I'm flexible! :) -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel