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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B93D4C46467 for ; Mon, 16 Jan 2023 10:32:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229918AbjAPKb7 (ORCPT ); Mon, 16 Jan 2023 05:31:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229722AbjAPKb4 (ORCPT ); Mon, 16 Jan 2023 05:31:56 -0500 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 214FC72AD for ; Mon, 16 Jan 2023 02:31:55 -0800 (PST) Received: by mail-yb1-xb2f.google.com with SMTP id o75so29767238yba.2 for ; Mon, 16 Jan 2023 02:31:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=VUQbpg5HItyWZZQATZnM4RSqQnbK+YIpF8+VzAqkd5I=; b=IstoYocSG5xOkpunE8iwoJn5VW1Lf6txDYxlwbE9gLBA4UUbZcr2TsYfEIb7+6bVpa p31BAHAWnZz/ffgjLfOi2kZ4218d3P0P5yNcCSIE21W4PgPo5RAyXQLO2zSXfX9lBEVJ qiwvYlGO/06zz8euC5RyVJ0KBJf845R8Qj4egFcq3aSwfSh/bpuCy/XnYYAXMFid96pZ rXqqE6/KPqIisaVgCxYJLJFK3YOcw+xfWLgCvuR3DDL6oANtpDmhxtBFshAbp/XKksZr ltv8rLiFpujyenRrpCAR1IB0yInd9y73VzdZgyKNDbgqQBnxwvdx3R5nSuVQ/0c+BsZ3 AY5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VUQbpg5HItyWZZQATZnM4RSqQnbK+YIpF8+VzAqkd5I=; b=PRX3KLS2E7WxynwUJDSrzSz1AHtdKBhgLq+WmkcExR6CzAjMayZ4pQTrFizBBK4Sza TW7NGK6TZ48b1O97ur6ko8oUCR9OHpwFiTCi3zWT7VId6tYeolAxWpNjZMyTdlZvqHCs PLvFzYhAdAv53nlI+PtmY2S023Exkcy+xTm3pbQjS8Ha0SrqKn3uwiFRhObCoYulcO+W yEUPRzJQVbVoO+IUbfvGd5JJvwlRFFEbjSDp59UvLvcjVchP5zNMKvgLGbFJmYiFZ/B9 t6+DtL6uSEVyhmgBsNcCXCW3YDTRo9dERnelQJhkx4ynGoiyfzbtuNE+K5LOwZ3tNUGD O/xA== X-Gm-Message-State: AFqh2krxR1UgGZ7NMqWPH80wxaG+6dkGPMVRPkHA2QRCth9AHWS/QykB Mz21tr/ffY0i0y1CecXE2WuCrB7ToEPAyuvrsrM1TP4TG+ZgzQ== X-Google-Smtp-Source: AMrXdXtm3G4lKafxGxvq3NBWSBSPmy4LNh0BElo99Uxgk7TClAhifk5n9ULTCijISaHOiEGO3x4inVbPGzqsOcccfgk= X-Received: by 2002:a25:6b0b:0:b0:7d2:8687:aea5 with SMTP id g11-20020a256b0b000000b007d28687aea5mr1186817ybc.210.1673865114014; Mon, 16 Jan 2023 02:31:54 -0800 (PST) MIME-Version: 1.0 References: <20230105215706.never.027-kees@kernel.org> <202301121452.14D1A95CA@keescook> In-Reply-To: <202301121452.14D1A95CA@keescook> From: Linus Walleij Date: Mon, 16 Jan 2023 11:31:42 +0100 Message-ID: Subject: Re: [PATCH] ARM: ixp4xx: Replace 0-length arrays with flexible arrays To: Kees Cook 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 12, 2023 at 11:54 PM Kees Cook wrote: > 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! :) Just pick it into your tree, the IXP4xx is low activity and I do not submit new material every merge window, so this is easiest. Thanks! Linus Walleij 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 D8612C54EBE for ; Mon, 16 Jan 2023 10:33:17 +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: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=QFj67+QjQHI9fIToLyj7bTPXsnXk2EEm49WuwKpp4H0=; b=mbg6h+dSnzT3c2 zGXcW0p9HMyblTV5sOz3rOx8bw1+826cuGA0jVKpGfYS5NopYq6O1z0mLx15oTVZX/NBx/odd/DrG 8MqseRdwA+1RBSguGgT4WvpitRUfJqeqstcCm/XpGgV90wqnZlCMb9Uc7TZ6VhEZKn6KxKQMOQZG4 7XJBH259RJl8gGkhVsc24PVpf5tUpom88W8tyPmjrr+ZwLAb/9fTv+/PRXuC61AquE3DVIQIB0Srb g9du1nSVXBZ1VLskHZwtTpT0YLgxkHR9u+uqTjiTIGWUI0is6Re6HQ9LgDZt1KI23XZkvWkiDvWyt /BC1TdNS/f9sSu4j2xPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHMmj-009f5p-Am; Mon, 16 Jan 2023 10:32:13 +0000 Received: from mail-yb1-xb29.google.com ([2607:f8b0:4864:20::b29]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHMmU-009f1I-5p for linux-arm-kernel@lists.infradead.org; Mon, 16 Jan 2023 10:31:59 +0000 Received: by mail-yb1-xb29.google.com with SMTP id 9so12289558ybn.6 for ; Mon, 16 Jan 2023 02:31:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=VUQbpg5HItyWZZQATZnM4RSqQnbK+YIpF8+VzAqkd5I=; b=IstoYocSG5xOkpunE8iwoJn5VW1Lf6txDYxlwbE9gLBA4UUbZcr2TsYfEIb7+6bVpa p31BAHAWnZz/ffgjLfOi2kZ4218d3P0P5yNcCSIE21W4PgPo5RAyXQLO2zSXfX9lBEVJ qiwvYlGO/06zz8euC5RyVJ0KBJf845R8Qj4egFcq3aSwfSh/bpuCy/XnYYAXMFid96pZ rXqqE6/KPqIisaVgCxYJLJFK3YOcw+xfWLgCvuR3DDL6oANtpDmhxtBFshAbp/XKksZr ltv8rLiFpujyenRrpCAR1IB0yInd9y73VzdZgyKNDbgqQBnxwvdx3R5nSuVQ/0c+BsZ3 AY5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VUQbpg5HItyWZZQATZnM4RSqQnbK+YIpF8+VzAqkd5I=; b=EsfXEAq5cHmfdC5ypClubZvJN8GhHsTGbl3Qw476LqaK77lv6OUacYrzs+tEZb9Bun sOHZ+KJNkfSH7i+nwWfO4gHCGLoiGALXwg+q66POqO/BQxUJF0nniFRyXm8g9VQ9gnBo qCovQD3dcolruo0lagw3tDtx9QHdN0YZjNQX5aaQ2ikrz9d5A6xOqAudd5nhLNQqUI/j I3SAPLwsZW7vGdKjVPAhA4z/J6KlWhCQVKyiyrAFRbS+a9s7kTHjSFXn6jqOcXR4CdTQ 6LyGftoSVhC7cdN/yr5k9tAWpTjUmo5jWmVwYQlVZrexYfhNzmk8/ixOne9gCD7u8kLn xPjA== X-Gm-Message-State: AFqh2kp85hffToI01duJ5KoVSczgvNZWtWXR/krWqXCiG2JMy1bGQwwp UwtkuLMP1CBy7ZOZ0WpGmktIbHA0p+rKLk2L0Q+idw== X-Google-Smtp-Source: AMrXdXtm3G4lKafxGxvq3NBWSBSPmy4LNh0BElo99Uxgk7TClAhifk5n9ULTCijISaHOiEGO3x4inVbPGzqsOcccfgk= X-Received: by 2002:a25:6b0b:0:b0:7d2:8687:aea5 with SMTP id g11-20020a256b0b000000b007d28687aea5mr1186817ybc.210.1673865114014; Mon, 16 Jan 2023 02:31:54 -0800 (PST) MIME-Version: 1.0 References: <20230105215706.never.027-kees@kernel.org> <202301121452.14D1A95CA@keescook> In-Reply-To: <202301121452.14D1A95CA@keescook> From: Linus Walleij Date: Mon, 16 Jan 2023 11:31:42 +0100 Message-ID: Subject: Re: [PATCH] ARM: ixp4xx: Replace 0-length arrays with flexible arrays To: Kees Cook 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230116_023158_238339_5A525EEF X-CRM114-Status: GOOD ( 18.21 ) 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 Thu, Jan 12, 2023 at 11:54 PM Kees Cook wrote: > 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! :) Just pick it into your tree, the IXP4xx is low activity and I do not submit new material every merge window, so this is easiest. Thanks! Linus Walleij _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel