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 63F16FA373E for ; Tue, 25 Oct 2022 08:58:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229652AbiJYI6s (ORCPT ); Tue, 25 Oct 2022 04:58:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230090AbiJYI6q (ORCPT ); Tue, 25 Oct 2022 04:58:46 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8F73F6179; Tue, 25 Oct 2022 01:58:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666688325; x=1698224325; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=wobCzPymTGLVzVS8xvZoimtbG8thJgFTUNq5m2nYbf8=; b=DX0A2hmbJd6Y0GVRp/YAmFAWb9SBxsVoummfNRHb5sW8OhuiSHlL3uot tdzhk13bzIPOY907arjmmKrmjYega+BUwIEhOX8HHpM43VTYmSd+9HxLk xdHIeKilpplajrBkbFFKDtld3JymtVOGJk8aD5NZzfT9LZR/+y2yDVMps 8r74ExbmHkkhxr7NCZpUooawI98aHPomtaDJHDnsy3GtyZn9WW6o1T3i5 x17c+HrzdJRGX4MlQuWubHFcCKspyDniuCkrYWPClN52w9VkTNAY2dA9E kHQBAuCWdj2tbG8COvqUOtD5wYxjNhJosnpBOIdpAwb64t7YMuoybtytI A==; X-IronPort-AV: E=McAfee;i="6500,9779,10510"; a="393941983" X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="393941983" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2022 01:58:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10510"; a="582704669" X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="582704669" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga003.jf.intel.com with ESMTP; 25 Oct 2022 01:58:39 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1onFld-001udB-05; Tue, 25 Oct 2022 11:58:37 +0300 Date: Tue, 25 Oct 2022 11:58:36 +0300 From: Andy Shevchenko To: Kees Cook Cc: "Darrick J . Wong" , Zorro Lang , linux-xfs@vger.kernel.org, "Gustavo A. R. Silva" , Keith Packard , Francis Laniel , Daniel Axtens , Dan Williams , Vincenzo Frascino , Guenter Roeck , Daniel Vetter , Tadeusz Struk , Geert Uytterhoeven , Paolo Abeni , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 2/2] xfs: Use flex_cpy() to check extent copying Message-ID: References: <20221024171848.never.522-kees@kernel.org> <20221024172058.534477-2-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221024172058.534477-2-keescook@chromium.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org On Mon, Oct 24, 2022 at 10:20:58AM -0700, Kees Cook wrote: > Use flex_cpy() instead of memcpy() to copy the bui_fmt flexible array > structure, which will perform bounds checking internally. Avoids the > false positive warning seen under FORTIFY_SOURCE: > > memcpy: detected field-spanning write (size 48) of single field "dst_bui_fmt" at fs/xfs/xfs_bmap_item.c:628 (size 16) ... > #include "xfs_error.h" > #include "xfs_log_priv.h" > #include "xfs_log_recover.h" > +#include Wouldn't it be better to include it before any "local" headers? -- With Best Regards, Andy Shevchenko