From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2D1B1E32A3; Thu, 10 Apr 2025 07:59:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744271976; cv=none; b=SXEHF9keqtCHEw4/GSzOaVIuryxQDrN8K/WNwoPnTUXWqLTYhB+9xxFI2rX2Z95ToKUqq1TQQPzsmadBqphqi57KRLNByTywAyWRjL3EQYLCdSd1ybC4YExpn/W8APIKi1L5PzIFuJyy4jM02p2VR3CjA5ehnhN/3zRoCDNGzqc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744271976; c=relaxed/simple; bh=UiSeec8bgOQw16nTOooUF8MdvjIJ33hXBd2rH5yhSCU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=abDF0E6WcfwK7Zv6awIDvA4ouT5Mek1PNEEGsn4usxOMRHEQVMSCSYADRcZtUTLZmFlqBx0kbOFIvbcrfbeJXO5pNC1AHQs85KewF9437r0Ej039biHpaa7DIka2JkLDlpmnwC1Ms0+QqFcCr2uMB8iR+whpy7xzpWPh+n6UzEA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SWEIc/rX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SWEIc/rX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36842C4CEDD; Thu, 10 Apr 2025 07:59:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744271976; bh=UiSeec8bgOQw16nTOooUF8MdvjIJ33hXBd2rH5yhSCU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SWEIc/rX/KxApXAtDmJfJ55hJ00ScI52B8dPy00YaUEhWl7b6YeJK5+n+uSuWPWkL QBC76xoUicSo3qCD42e89bWhRzl4iPw0eN7pSlFjz43l5OYcj8fkS9aF0xw7NgaLgX KBG9QOUmtc3wFsGq/9x+4D4/p2Uwy1CBFw2s8JZ1m82o2OWcpUvGbJuXxWd2SxRDhT JRRoLND1ivpuU3OrOUgySVUBYvFmK8doxbEDflMlUmgnOWuQM8/uhWilR/nRztPFiT sQP0kkZ+NGj9lBcH+R1XI7zd6oKHrSWnTXYmPj5sHx7iEE8zeVEClEwWvFzLDZQkaI HttyTZWdQt65g== Date: Thu, 10 Apr 2025 10:59:28 +0300 From: Leon Romanovsky To: Arnd Bergmann Cc: Jason Gunthorpe , Arnd Bergmann , Dennis Dalessandro , Steven Rostedt , Thomas =?iso-8859-1?Q?Hellstr=F6m?= , Jani Nikula , Christian =?iso-8859-1?Q?K=F6nig?= , linux , Maher Sanalla , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] RDMA/hfi1: use a struct group to avoid warning Message-ID: <20250410075928.GN199604@unreal> References: <20250403144801.3779379-1-arnd@kernel.org> <20250407182750.GA1727154@ziepe.ca> 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: On Tue, Apr 08, 2025 at 02:40:38PM +0200, Arnd Bergmann wrote: > On Mon, Apr 7, 2025, at 20:27, Jason Gunthorpe wrote: > > On Thu, Apr 03, 2025 at 04:47:53PM +0200, Arnd Bergmann wrote: > >> From: Arnd Bergmann > >> > >> On gcc-11 and earlier, the driver sometimes produces a warning > >> for memset: > >> > >> In file included from include/linux/string.h:392, > >> from drivers/infiniband/hw/hfi1/mad.c:6: > >> In function 'fortify_memset_chk', > >> inlined from '__subn_get_opa_hfi1_cong_log' at drivers/infiniband/hw/hfi1/mad.c:3873:2, > >> inlined from 'subn_get_opa_sma' at drivers/infiniband/hw/hfi1/mad.c:4114:9: > >> include/linux/fortify-string.h:480:4: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror] > >> __write_overflow_field(p_size_field, size); > >> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >> > >> This seems to be a false positive, and I found no nice way to rewrite > >> the code to avoid the warning, but adding a a struct group works. > > > > Er.. so do we really want to fix it or just ignore this on gcc-11? Or > > is there really a compile bug here and it is mis-generating the code? > > > > The unneeded struct group seems ugly to me? > > Having a clean build would be nice though. Do you think a patch > that just turns off the warning locally would be better? I don't think so, as you will need to disable warning for specific compiler, which won't be nice. My preference is to have a fix. Thanks > > Arnd