Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp120210pxf; Tue, 30 Mar 2021 21:44:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzohnBdMQ6pfG5pnAQmi8T5WR3S9xvBczko+fSe7o23kCngXRr+aa0BWkbdBFzftvZzSY0h X-Received: by 2002:a05:6402:4407:: with SMTP id y7mr1331917eda.247.1617165881606; Tue, 30 Mar 2021 21:44:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617165881; cv=none; d=google.com; s=arc-20160816; b=xtyN0njBPw9mtLskbd4/X8feHCpRtNC+af74aZgdHriVLdI4o25Dz2GWb6jz869qrw IFzzEyog7+ZgXEKlmYnwSmxnfQgpYOEBZ9gWLoig9naXbXn6J+UOqE5wRzuq2RJ0UykQ YL8rnMF33d/N2io49z3RQ/Kk6hoe88RMutvaYla0mVeIR+wSFXS/bO/Hnc4TorhCV5Zl pzDcL5OA9jco7/0H3P08pZz64386V+gjBRzytBzmmfouC9cdovWBzbhayLu0/fvHg9O7 CsuPA+yyKKYd6poivj6Gqx1LkmiTqGvrL15ZT9v9gW6b/MFajBao0CMcXnW7ooFVnktG fB2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=8kOhgYYe9lF0D8a+CJ3xRCxjQ5p3MDx84vwPZnMdEfo=; b=HEjn6quEs3GV8cmpXgN69tyQD7XAVWlteigzp4P7oHzA45va2OazWxQOkBIu7+nIZ0 lMg6CdRGFvr17y0/jHz2KxS45DYmtR6hwrlD8i8Q8yGKj5UXbl2+OdJImqDDhkCRSl/d nb+8ftWDuzsNBKnn8DuVPe6q4a/GFFSWPuNbPQnrv/PcjQrRvTbHEgxp0N7M5OUTFSRd m+9sydptCUbWvRDNB9g24GeuVLf4K3MeAAEFfs74TC3G9HnJ9Ahbi5afywu/PmVhNqNq 0PUwFbh5GdYr7Pp3Sna/TkiYipOFCoJAv/hDFOYEaGFIZd7uoSyxRTH7W07J7pL9qNd0 fcGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=xkXPTK9N; 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 o9si879867edc.244.2021.03.30.21.44.18; Tue, 30 Mar 2021 21:44:41 -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=@linux-foundation.org header.s=korg header.b=xkXPTK9N; 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 S233558AbhCaEnX (ORCPT + 99 others); Wed, 31 Mar 2021 00:43:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:35030 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229959AbhCaEnV (ORCPT ); Wed, 31 Mar 2021 00:43:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 033256146B; Wed, 31 Mar 2021 04:43:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1617165801; bh=UdCoaA3sJ8z5N002h6jBT07ZBJSUx0gnuR107bZBVpc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=xkXPTK9Nog2Z87eV20bMjEQJLSaujKYteiw04LKUJ1q3J9J/PSHnlAwcb1tKPbpSe FcUG4bWqb9nWrNZD0SnivRxpStr6FN6hpWhGu4AtKjpp/36ExgFXc4ZbmxzOiC7cGd roDtFBknoXmbF63G/OkEh0U9vL3aHwFwtNEsnJQo= Date: Tue, 30 Mar 2021 21:43:20 -0700 From: Andrew Morton To: "Gustavo A. R. Silva" Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] hfsplus: Fix out-of-bounds warnings in __hfsplus_setxattr Message-Id: <20210330214320.93600506530f1ab18338b467@linux-foundation.org> In-Reply-To: <20210330145226.GA207011@embeddedor> References: <20210330145226.GA207011@embeddedor> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 30 Mar 2021 09:52:26 -0500 "Gustavo A. R. Silva" wrote: > Fix the following out-of-bounds warnings by enclosing > structure members file and finder into new struct info: > > fs/hfsplus/xattr.c:300:5: warning: 'memcpy' offset [65, 80] from the object at 'entry' is out of the bounds of referenced subobject 'user_info' with type 'struct DInfo' at offset 48 [-Warray-bounds] > fs/hfsplus/xattr.c:313:5: warning: 'memcpy' offset [65, 80] from the object at 'entry' is out of the bounds of referenced subobject 'user_info' with type 'struct FInfo' at offset 48 [-Warray-bounds] > > Refactor the code by making it more "structured." > > Also, this helps with the ongoing efforts to enable -Warray-bounds and > makes the code clearer and avoid confusing the compiler. Confused. What was wrong with the old code? Was this warning legitimate and if so, why? Or is this patch a workaround for a compiler shortcoming?