Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp26122lqg; Wed, 10 Apr 2024 14:10:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXVEIMdZqgvE91lVizkLT9Xtb3xXTlcNcpr4vl1SzH6vRF4wxIV4+gMcMfp2FV4W+VvlWUTSovrlxRGEVTUARsXRGF0EGM4DnMujZlv9Q== X-Google-Smtp-Source: AGHT+IEbbehzAKAPEoclUFScyo3PDD5+sktEAmuREwBRHA2tFn66L5S1JGOXqd+H+U8d+Gff0WeR X-Received: by 2002:a05:6a21:4981:b0:1a7:2924:7317 with SMTP id ax1-20020a056a21498100b001a729247317mr4166808pzc.49.1712783424718; Wed, 10 Apr 2024 14:10:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712783424; cv=pass; d=google.com; s=arc-20160816; b=kPU+z0veQjxTc/YKvJyDprn378slKEeRPKh+BQuBj/7hcVXEOIrxJvVavaFIskZn4Z i1hxIlhR/4iuBCsYoZW7WqSnkuKta3Ku+Wz6V2unFmzXzGouDC3EX1Ru7u6Ag0jFV5ef O5MPisy+MH3vxeTd08sm09S59/1iocRBT/qDRk13joK//0U5aiZtmjH0ITL7nhkew0YZ EJCe6ZDoO9jbvSLDyjOMBMQUQq/y06NNrOeLhE8eCY3f7BOoXp/cWK41FzXBd/oVH4Mz cGkD9bn3zpD0n18Ydj7VXL0VsRMNlkHmtNPwnXJlrCC4pozTIrIO7V/0e87atjuy8H/V hbDw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Bv/V2BDcZ6BXQvfxxNM1w/X7hHGQqyp9bJFqKpeVUk0=; fh=OXuKl9F0EYGCL3DPhSVfNTOpo62ImVofMHCa9d3muQI=; b=jFE963Xufk8SsmZ6lZmMXKCNM7Omcpz/wcXT74jJ9Qvc8eJsKicUsu2ewcPJ86v+8F T1SAd5knUH1/UBjJVFGuDTQdHA2RCWnOBLkOeXhcQ4lBYrhxeKf8DpYg0bcwORKkQnb1 ngl6E97PukDVMgDjWBtxh3f1zYu73ZlnsPHyMSMRn7APpOm5CrC2PIFkUDMGxjRtCtof FDDKcNb08tzynlRrqC/88U4SSm5i6uxINF21FnTP2BSXW8k2q/TG/PG6KYSkP13ypPQf +G21PL3BlZiT5MioXttZTqajV8ywFFc6E6WuSMCWvLd/VvAXQ2aTcqzRlw3wOlwZu5/N LMyA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="WNqDt/ie"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-139352-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139352-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u17-20020a63d351000000b005df43caee00si11414708pgi.318.2024.04.10.14.10.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 14:10:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139352-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="WNqDt/ie"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-139352-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139352-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6290228462E for ; Wed, 10 Apr 2024 21:10:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F141184103; Wed, 10 Apr 2024 21:10:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="WNqDt/ie" Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7A911836CD for ; Wed, 10 Apr 2024 21:10:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712783408; cv=none; b=Vvq0TmvafTjBWz4lgZeZWZxr9ch5PtKC12Ew2iuLcbWCv2050K0WtXWN6OyAdfjt4RY6aTwYGhePUhEP4zCRVPf7UqRhMFGYVb7C+AfUU7NTO9ohsCUW3TzdLmCYMszvp+rtrxfSzfUBuzucMHqgJTJnIZqE9A1tZj7AdmCndgs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712783408; c=relaxed/simple; bh=bFyrIcuDs7nmErevy2zekDsqStQqLe+bXtd72c5CLDU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pBZoCHx9MaPuVa16jXYOc3d09oZdmL6ks0vUAYlD+UOZIoekWmA41CAUqT5Nrc8sbPb3SKaK+rjexS/Y0INJz4vKLXz9ooJBA+vMyV6K68wMb4qu22D686LXRy/DOPqRMx2T2NixI7kyrrQiIy0Mhtm3Rvk3YK39KSLMJs5GHb4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=WNqDt/ie; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6e782e955adso6711020b3a.3 for ; Wed, 10 Apr 2024 14:10:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712783406; x=1713388206; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Bv/V2BDcZ6BXQvfxxNM1w/X7hHGQqyp9bJFqKpeVUk0=; b=WNqDt/ieiDDCpUgP6O6kSxj5PVgwLbF1THE0dpO5cAhGSYnAcLyFM2h2ZYM73cjp0m sW3KlsnS0pwbtBZhVVv73zk25Y0cma1sfOSxSDXZjW8xp6gh7uWH5Rxow3wQRZ9dbNJB Fy8vnzyzSN7dwz3UMG4hcZ58Xd3P38YsKWKC1A7f18tnPQWS2WZqmzT56wN06oAvqma9 cTzcZwExSvVWPPlfX3xOIffdLSDk2ARnk0fJh0vpd2W5nfwp+JZ1QQXiNvKmqMyBS/+P GiYzSObqpgC9DuLrrjKCk99Ryh62B9+9aXtkm9cFQHqIAt3AlvBVzT4S12QiE4IRp5aA SFJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712783406; x=1713388206; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Bv/V2BDcZ6BXQvfxxNM1w/X7hHGQqyp9bJFqKpeVUk0=; b=swF9I2LqF692YpFTYG50gc4hPCFaWgiE/OMP3rYuEbjaDLOWtut4eh+pKWIBOZJfvs nngk1uL69B0ON7AdzIrQtPsp7L8wuSyNwUGuyibD2WJvvDj4jlwZDRXOoujMgRbKHI+m 5dTXT3tcxqRmmuDXj4XGQvB90ZvGvr5S1Pl50ItE5YXDyZZ/r5f5f6z57mb6uXrvMDdV jy23BKR2idgRAURLv8Hp56a/WKI5dI3c6ssTxZ0tTk7e1pB9Zy81M8+5+tV0y7EyYxGi DM2lXLYnQfSy9zb0L/vy87l3rcTbK1SkRRvcTSqlI21xt90mkx4gvE1EfkAbBLl6WiG4 zjJg== X-Forwarded-Encrypted: i=1; AJvYcCXc1rYpSuBZv+WtEX0rCv3TbX8m+3MISkrLaDy2QZNxosPLcFSmn6LsorRsfeZcEd3AKr7tTMQ0qUNlwuu2vq0Mb7T4gEeycs2/+KY2 X-Gm-Message-State: AOJu0YyjW4hVIfUUGuIbeRHwX9bjXHznPDSXMQU9mijbbTOAbjIruA2i 5w2hWpoVdb7MGgCg1F8dQGGu2v2PEMfFCxD/K5CbzOQiVKjOPT+Ip7BYHy75XQ== X-Received: by 2002:a05:6a00:3d42:b0:6ed:21bc:ed8c with SMTP id lp2-20020a056a003d4200b006ed21bced8cmr4678360pfb.18.1712783405518; Wed, 10 Apr 2024 14:10:05 -0700 (PDT) Received: from google.com (30.64.135.34.bc.googleusercontent.com. [34.135.64.30]) by smtp.gmail.com with ESMTPSA id w22-20020a634756000000b005dc4da2121fsm10368167pgk.6.2024.04.10.14.10.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 14:10:04 -0700 (PDT) Date: Wed, 10 Apr 2024 21:10:01 +0000 From: Justin Stitt To: Arnd Bergmann Cc: linux-kbuild@vger.kernel.org, Arnd Bergmann , Richard Russon , Jens Axboe , Robert Moore , "Rafael J. Wysocki" , Len Brown , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Andrew Morton , Masahiro Yamada , Nathan Chancellor , Nicolas Schier , Lin Ming , Alexey Starikovskiy , linux-ntfs-dev@lists.sourceforge.net, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev, linux-trace-kernel@vger.kernel.org Subject: Re: [PATCH 2/5] [v2] acpi: disable -Wstringop-truncation Message-ID: References: <20240409140059.3806717-1-arnd@kernel.org> <20240409140059.3806717-3-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: <20240409140059.3806717-3-arnd@kernel.org> Hi, On Tue, Apr 09, 2024 at 04:00:55PM +0200, Arnd Bergmann wrote: > From: Arnd Bergmann > > gcc -Wstringop-truncation warns about copying a string that results in a > missing nul termination: > > drivers/acpi/acpica/tbfind.c: In function 'acpi_tb_find_table': > drivers/acpi/acpica/tbfind.c:60:9: error: 'strncpy' specified bound 6 equals destination size [-Werror=stringop-truncation] > 60 | strncpy(header.oem_id, oem_id, ACPI_OEM_ID_SIZE); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/acpi/acpica/tbfind.c:61:9: error: 'strncpy' specified bound 8 equals destination size [-Werror=stringop-truncation] > 61 | strncpy(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > The code works as intended, and the warning could be addressed by using > a memcpy(), but turning the warning off for this file works equally well > and may be easir to merge. Dang, I would've really liked to see these strncpy()'s dealt with [1]! The warning is there because that specific usage of strncpy is plain wrong. strncpy() is a string api and this usage looks like it has arguments and results not resembling C-strings. Not sure if turning off correct warnings is the right call. Link: https://github.com/KSPP/linux/issues/90 [1] > > Fixes: 47c08729bf1c ("ACPICA: Fix for LoadTable operator, input strings") > Link: https://lore.kernel.org/lkml/CAJZ5v0hoUfv54KW7y4223Mn9E7D4xvR7whRFNLTBqCZMUxT50Q@mail.gmail.com/#t > Signed-off-by: Arnd Bergmann > --- > drivers/acpi/acpica/Makefile | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile > index 30f3fc13c29d..8d18af396de9 100644 > --- a/drivers/acpi/acpica/Makefile > +++ b/drivers/acpi/acpica/Makefile > @@ -5,6 +5,7 @@ > > ccflags-y := -D_LINUX -DBUILDING_ACPICA > ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT > +CFLAGS_tbfind.o += $(call cc-disable-warning, stringop-truncation) > > # use acpi.o to put all files here into acpi.o modparam namespace > obj-y += acpi.o > -- > 2.39.2 > Thanks Justin