Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1677302rdb; Wed, 20 Sep 2023 16:50:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1Gm+kmZjapQRSJfGcveMeKWOsowoP6OJqbMhBGtlCpYTF5Ji2M4r9eg+lwjxh5pznOrkV X-Received: by 2002:a05:6a00:2d12:b0:690:463a:fa9d with SMTP id fa18-20020a056a002d1200b00690463afa9dmr4443100pfb.22.1695253859329; Wed, 20 Sep 2023 16:50:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695253859; cv=none; d=google.com; s=arc-20160816; b=08y0dU329qR7GK9IngFDxBJ8Vqf0PuLrW5UKqExXDnyexqwCAVD8aGRvd/kXOLUhLJ ajFSNL4sgfo5h91+IfcT7zXPr964RYYjnr02cAz6dwMA0lCe0F2/VWS5vUglJqTk4rKj sYp7F/keSh/kii6BDOAG+ySPaWtMVr+AQ2teAn7YgMvEpSkqd736CfYI9b71fDwyBEOl 3ydyRnnBg38P3FQGBg7awTx2TZGgSa1gVx0wZMhC1vee9uNvZtwdrn9cf2GFWYFreXfn 6DtiIZ67IH3aiZz6Phl3Y66JT3X2cv5oahS92yhmsiduCQDJB0N2Jm8lIIyDUpM0I+2B JaJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kZPdmXl4ZwuGt3eSBwgMVSxnCz69SpDGNBEX3pNmeW4=; fh=e/39/UpfHkQeL6oZ3Q05+VQq/UlTVhUi8fAX4zmSpW4=; b=zX5rckm9NFjZ2LxJ7frP0UZHOlxos1OtEWa8jjQYqloWKYGvmCnOqbCT2C6r7EL/S/ 1T+7jO1i9a8CutfPNjPbxMLkmP1Qk/qA6ThdpiXlCKNQqe172szvgCWbSmaseRhqMCD2 L2VNn4fOP5UrXTzNCIXZWvaAtOtGyMlS7uMBX2EfdhXuDNoxXLSz1YUBLhEMaa0HeTXY /oeiZy4xRfS8SvVNMM4kITzbKhFOQnBeepxzXfLjx2oYHqIOw/JLXT8p6JN6UPTqom90 /Xj+SmNAKj+9WHbHG3dHHMORP1SgsHCeKDXLClpbXwFCAXZ+ktYpNzghCrTN0INTpzMp qCQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dBGejAoi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id ch3-20020a056a00288300b00690d55d630dsi206600pfb.274.2023.09.20.16.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 16:50:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dBGejAoi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5E2938021D9F; Wed, 20 Sep 2023 09:09:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234696AbjITQJn (ORCPT + 99 others); Wed, 20 Sep 2023 12:09:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234913AbjITQJk (ORCPT ); Wed, 20 Sep 2023 12:09:40 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29A94B9 for ; Wed, 20 Sep 2023 09:09:35 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-68fbd31d9ddso5585667b3a.0 for ; Wed, 20 Sep 2023 09:09:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695226174; x=1695830974; darn=vger.kernel.org; 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=kZPdmXl4ZwuGt3eSBwgMVSxnCz69SpDGNBEX3pNmeW4=; b=dBGejAoiNfKlqcB9pU3BB1FsLB2r/BlAQUcI9iy6LZq7I2DdVJA/UwAFMxlZOn/Z+B kTGq/zI11AKO4BEUYQx0Db78V5bO5N+nFKI7MNRocKcrRyhd4CcASMeOh6xb7f5fgKCz ugnzDCxsJQ62TsnOs3UWlklgLILb2eN8/lF8M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695226174; x=1695830974; 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=kZPdmXl4ZwuGt3eSBwgMVSxnCz69SpDGNBEX3pNmeW4=; b=Tbnw4wZWn1Q3ptUOduG2wdXaj3liJChElBTGIQjde6eAbXSRy17wb2hMXKqSG3oo3/ jA+HK7eX1C3y1I+KkTs5O99gD25+13+K8D1gRxAP7ZytE9n4S1ELtZoo1grovVvcV3hX jr/yZQF1NHe+NbMsxb/MivU3/IpLOGypfoLv4wmQ6QmGNMp4VM4jOG3dCW7Boxu4Uspd wCuHzu4lij7B2cdoO1c4Q3Pl+E823aDgXvx/kvS1mAs0i1sjj3CguLa3VlqNaAqZmopU vkdmJAfFumU5FIYWgAzZlZ66lGPpFUPuLwcUq3px42TbwL/3xu2EK4ZQwcmXlP/G5sNT n48w== X-Gm-Message-State: AOJu0YwEwhsbvSKaxSzFKCKXHg25iPz8KDiYvlaREe5IsJe8k94XLR0e 51y4Om4rne//C/XgASemiiUPlQ== X-Received: by 2002:a05:6a00:8087:b0:690:f6a1:ae62 with SMTP id eh7-20020a056a00808700b00690f6a1ae62mr1544166pfb.23.1695226174549; Wed, 20 Sep 2023 09:09:34 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id x23-20020aa793b7000000b0068bbf578694sm10668960pff.18.2023.09.20.09.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 09:09:33 -0700 (PDT) Date: Wed, 20 Sep 2023 09:09:33 -0700 From: Kees Cook To: kernel test robot , Mirko Lindner , Stephen Hemminger Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: Re: include/linux/dma-mapping.h:416:36: warning: array subscript i is outside array bounds of 'dma_addr_t[0]' {aka 'long long unsigned int[]'} Message-ID: <202309200904.CEED70DA33@keescook> References: <202309191958.UBw1cjXk-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202309191958.UBw1cjXk-lkp@intel.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 20 Sep 2023 09:09:43 -0700 (PDT) On Tue, Sep 19, 2023 at 07:27:26PM +0800, kernel test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > head: 2cf0f715623872823a72e451243bbf555d10d032 > commit: df8fc4e934c12b906d08050d7779f292b9c5c6b5 kbuild: Enable -fstrict-flex-arrays=3 > date: 4 months ago > config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20230919/202309191958.UBw1cjXk-lkp@intel.com/config) > compiler: loongarch64-linux-gcc (GCC) 13.2.0 > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230919/202309191958.UBw1cjXk-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot > | Closes: https://lore.kernel.org/oe-kbuild-all/202309191958.UBw1cjXk-lkp@intel.com/ > > All warnings (new ones prefixed by >>): > > In file included from include/linux/skbuff.h:28, > from include/net/net_namespace.h:43, > from include/linux/netdevice.h:38, > from drivers/net/ethernet/marvell/sky2.c:18: > drivers/net/ethernet/marvell/sky2.c: In function 'sky2_rx_unmap_skb': > >> include/linux/dma-mapping.h:416:36: warning: array subscript i is outside array bounds of 'dma_addr_t[0]' {aka 'long long unsigned int[]'} [-Warray-bounds=] > 416 | #define dma_unmap_page(d, a, s, r) dma_unmap_page_attrs(d, a, s, r, 0) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/net/ethernet/marvell/sky2.c:1257:17: note: in expansion of macro 'dma_unmap_page' > 1257 | dma_unmap_page(&pdev->dev, re->frag_addr[i], > | ^~~~~~~~~~~~~~ > In file included from drivers/net/ethernet/marvell/sky2.c:41: > drivers/net/ethernet/marvell/sky2.h:2198:25: note: while referencing 'frag_addr' > 2198 | dma_addr_t frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT]; > | ^~~~~~~~~ The .config has: CONFIG_PAGE_SIZE_16KB=y which makes PAGE_SHIFT == 14 #ifdef CONFIG_PAGE_SIZE_16KB #define PAGE_SHIFT 14 ETH_JUMBO_MTU is: #define ETH_JUMBO_MTU 9000 which forces "ETH_JUMBO_MTU >> PAGE_SHIFT" to be 0. I think the right fix would be: dma_addr_t frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT ?: 1] Thoughts? -Kees -- Kees Cook