From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E107155747 for ; Wed, 11 Sep 2024 14:14:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726064101; cv=none; b=HHTwWuqasNWw1/YCV+4o4gon3A6sTs/QmEf47u6VHjn06ZuaGla8D+OUiV9NuygAfUPRBkt5ORp7erpU6+rskHVrZIpo2SCJj7TxZybFTZbdqXZZqcYwJ4JY9WNQUPxBoqYZylydfmB0b5Szr/B/71H06EZItlspK+d0ryli/Zs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726064101; c=relaxed/simple; bh=6zMtsXVTcgFC3FHf7dXOGo/FZsdrFHeaU64XO3BDDBk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HEvCs2fejqoYbO2u0IijpRQyIT08Upb4tVzn3g/rerXhpX2oGUi2QLwZdfXslfSKYDRc7cBiQxb8Jc5yWQglqhm1Fon9ZuEsV3oYUYIvIPEJEpGs83d68xnHceLgutyTUxC59nNrdJcQiR487e9ImV5QHK3p+Atf5YXMNOzr4Qc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 050A11007; Wed, 11 Sep 2024 07:15:28 -0700 (PDT) Received: from bogus (e107155-lin.cambridge.arm.com [10.1.198.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 982BB3F73B; Wed, 11 Sep 2024 07:14:57 -0700 (PDT) Date: Wed, 11 Sep 2024 15:14:54 +0100 From: Sudeep Holla To: Arnd Bergmann Cc: Arnd Bergmann , Cristian Marussi , Jens Wiklander , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] firmware: arm_ffa: avoid string-fortify warningn in export_uuid() Message-ID: References: <20240909110938.247976-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240909110938.247976-1-arnd@kernel.org> On Mon, Sep 09, 2024 at 11:09:24AM +0000, Arnd Bergmann wrote: > From: Arnd Bergmann > > Copying to a 16 byte structure into an 8-byte struct member > causes a compile-time warning: > > In file included from drivers/firmware/arm_ffa/driver.c:25: > In function 'fortify_memcpy_chk', > inlined from 'export_uuid' at include/linux/uuid.h:88:2, > inlined from 'ffa_msg_send_direct_req2' at drivers/firmware/arm_ffa/driver.c:488:2: > include/linux/fortify-string.h:571:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning] > 571 | __write_overflow_field(p_size_field, size); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Use a union for the conversion instead and make sure the byte order > is fixed in the process. > Thanks for spotting and fixing the issue. I tested enabling CONFIG_FORTIFY_SOURCE but couldn't hit this with gcc 13 and clang 20 Also do you want this sent as fix on top of my FF-A PR now or after -rc1 ? -- Regards, Sudeep