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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 016DFEE49B7 for ; Wed, 11 Sep 2024 14:27:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SsCKXBcBJcfVmRWnPEemE/nlmz1V6IYLC0D75lS/N7A=; b=zGmElHXjqzJiTo/pDhjOn2gvcF l383NZnEffwa++Qk3rro6XooGIalFCJ0tGW+4tvQUh7fYAcjiqQXvwB2E6eTWJrYPpbmZlq/fcvZI x0ra7NbAfSlXnhkYTehYBTWzFHxhS7jQ3DlUyqQkeRvy6IrfgOJ6i5GY/2AwoCwF0vLOCMl1ZsdF1 u25qLpJ35V8mmLk2kFhDpf/O3rJmK+UmWtphqoDoKhiRcvLHUamquQamGWPtdoB/52hzt2EuHz9Lo 8gbClBluBNT48L5RU+lQed3h4pHgtuTxWDO7CLw7lfC5SdwWIhDzaqrYRNvuxO17UwxP7xwWZQZgl BdG7KWfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1soOJH-00000009tdN-19Ik; Wed, 11 Sep 2024 14:27:07 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1soO7Z-00000009rUD-3urB for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2024 14:15:03 +0000 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240909110938.247976-1-arnd@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240911_071502_377164_535384A7 X-CRM114-Status: GOOD ( 13.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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