Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5659314pxj; Wed, 23 Jun 2021 06:21:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1WEcQ4L0Aw15UA67/yGW42Ti2qMLn+0hQXqKBqliRcV+lAc/JfFdUBbJX4F5dXN2l03/g X-Received: by 2002:a05:6402:d0a:: with SMTP id eb10mr12648628edb.139.1624454512394; Wed, 23 Jun 2021 06:21:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624454512; cv=none; d=google.com; s=arc-20160816; b=nefjXzNNmgHFFuYGiR3ULwHwDTswtAHTV29xE+OyKEi4ycp4XRXhzKyMzPBQQHcHvY IqajBLZtILVXRhqzdM6Td3/a3yKOAJ++oO199Ce1ydazGmCCoTEevMIoh3zuztcJ/042 41UtGz0uSWrs6Xlke6CKfD/NddI3f8EWoSQJfED38fIiYTV8GMGojjXDt+HOI0oTRvpO xBFLmckM521ODEbnyhbuXSsadPIwGe5Z4hOeUkcu4JJ4he9ky+z7aDksJKBrWxxnuYUN 7JT4bizv+tzlK2iwDxV/6zyAGVmuC50PKOLjEQ5Muubu8bVw28Zuh6W6v/4G6OfLcMfE 8bzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:mail-followup-to:reply-to:message-id :subject:cc:to:from:date:dkim-signature:dkim-signature; bh=dfMFKHsJyGe6s9j3AqCisKZpKc5CSt1HEdHK/3NyuME=; b=jaP3DtXV0Xrbr4E2q8gqUF6jtSoFzmteJtb+velwQV6m6OfRc2d5A5EadGYxQ8g4Pj GkUUKDjpUSRiIXq1I49LpRI3PDSZECDKhINMS96ZHeG7sP8xcHVW3i2kAMk/tH8ExpKK Rsnubt4XAneWRR30l/Au7m3yG2uvFdI/igAHzPF73cbQB4PoumHO1tpCuYt0XJ4xkmIH f9BGr8WPP9F4NElYYq8GV5RcqWXGKpmkim8M/8UqlPzLhL7p8kGihE5jM0tb+OdM7nlw j8+LZN+RFtE/5KHVGF9Tbc2sBexl26uxOA0kVEZHzuvA2+rQOufDY3vtdnTKrm0VYORl Vudw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="woyana/I"; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id em21si9442797ejc.542.2021.06.23.06.21.29; Wed, 23 Jun 2021 06:21:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="woyana/I"; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230308AbhFWNUH (ORCPT + 99 others); Wed, 23 Jun 2021 09:20:07 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:45892 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbhFWNUG (ORCPT ); Wed, 23 Jun 2021 09:20:06 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 979021FD66; Wed, 23 Jun 2021 13:17:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1624454267; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dfMFKHsJyGe6s9j3AqCisKZpKc5CSt1HEdHK/3NyuME=; b=woyana/IiU5yttk+2vl/QvcSpKjkgFGg/Fb0XKyTObiC0WX/5kGgh6pdPSBuVRaspBPJYU 7e10+GpRXkBUIPIGvQ36kc9QuSyoOKY/zRl78g6mILgwelkjw89NBtnxtbqonAtOV2piFS iF78aA17EAsgVUqiZJHkXmAHQ6XdsPc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1624454267; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dfMFKHsJyGe6s9j3AqCisKZpKc5CSt1HEdHK/3NyuME=; b=XqqwpdxeUJurOnzzfnldw/wN6bNAgU9OGyANMCusLZtpwx4SMh8dEvm7/ESDBkAiBAR8ht 8g/PC4Ex3/42d0Aw== Received: from ds.suse.cz (ds.suse.cz [10.100.12.205]) by relay2.suse.de (Postfix) with ESMTP id 6F656A3BAE; Wed, 23 Jun 2021 13:17:47 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 0D0EEDA8D6; Wed, 23 Jun 2021 15:14:55 +0200 (CEST) Date: Wed, 23 Jun 2021 15:14:55 +0200 From: David Sterba To: Stephen Rothwell Cc: "Gustavo A. R. Silva" , Kees Cook , Linux Kernel Mailing List , Linux Next Mailing List Subject: Re: linux-next: build warning after merge of the kspp-gustavo tree Message-ID: <20210623131455.GM28158@suse.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Stephen Rothwell , "Gustavo A. R. Silva" , Kees Cook , Linux Kernel Mailing List , Linux Next Mailing List References: <20210623083901.1d49d19d@canb.auug.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210623083901.1d49d19d@canb.auug.org.au> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 23, 2021 at 08:39:01AM +1000, Stephen Rothwell wrote: > Hi all, > > After merging the kspp-gustavo tree, today's linux-next build (powerpc > ppc64_defconfig) produced this warning: > > In file included from fs/btrfs/ctree.h:9, > from fs/btrfs/struct-funcs.c:8: > fs/btrfs/struct-funcs.c: In function 'btrfs_get_token_16': > fs/btrfs/struct-funcs.c:80:46: warning: array subscript 1 is above array bounds of 'struct page *[1]' [-Warray-bounds] > 80 | token->kaddr = page_address(token->eb->pages[idx + 1]); \ > | ~~~~~~~~~~~~~~~~^~~~~~~~~ The warning is correct, on powerpc and 64k pages the array has only 1 item, ie. only index 0 is valid. The overflow won't happen in practice though because of previous branch that would happen in 100% cases. The code handles when some bytes cross 2 pages but on 64k pages it's all just one page. To allow the warning to be enabled globally we'll fix it, I'll let Gustavo know once it's done.