Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1136381rbb; Sun, 25 Feb 2024 22:42:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVaugeQGR/Pqf45c7Tp6IbGd5tmxj8bRDsuEGj2yhV2xrgJAHo+QRznYjo4uXC3Dt2VEaJ+ewVWyi+CRG86JNqS+yNEXz1dY7jxIiPz4w== X-Google-Smtp-Source: AGHT+IFVMxsdUJnvopL9uCJlf1MQ/sBCSKtffjz6Rh1qQ+T2guxhn24CqGpO7cXIWuCcBZ6PBXlf X-Received: by 2002:a17:902:eb89:b0:1dc:a5fd:6de9 with SMTP id q9-20020a170902eb8900b001dca5fd6de9mr1255046plg.12.1708929755037; Sun, 25 Feb 2024 22:42:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708929755; cv=pass; d=google.com; s=arc-20160816; b=MJ6WbLElxUqvLBlE/DBTNEgxjeRbitM+UF+OcR4Ox3CnHlq9mGHfTb82RVkuERuB66 UbCWaU6MAV3GaNQsItV25JqSHfMOwBOkvUBdQxUcT1l3dcBnl20ncNhrfdEKPdgzJXKQ 3mdq8QoO8257avVadrr9tXTvZd9DqC7jIzY/NfZUP/kwBsx+KbzZ7X8Nx4uFTm+jveTx 02hSt+wGYU9WZnKsb4mrkWK3htNl8h5hc6/yMs7WWg9naAaNcy95YhzK7jBOj+1wghRU iL8ESr5I9a9lBc4GPK4zM191twTvZzUoCnT1rXgwEke89ZygFmsEYX4cqkqk8dmBinb4 PSkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=niqg6Cmwj6McOY6q6YOYSiG1lI/AhWSYhtFhttSI3+A=; fh=1aio4gEnRCrs6Mai6+PhBXtsgdpwtR3liyIEN4aEfXE=; b=ms38tLzB4bebX6HCOiKnTKqO9YNW0knYtFrVlJI/4iDE36A+kLGart1rbu4fAjK5Ym KIVLE2no/bV+QOCvGeJuQh2+PYtSh4Gz0f8Wauzn/KXyX6UG0UDqTvlD3hmqynwesdOc 5uoeUI5Yc7h4DdmG4/aPIiQREnJMILojWPD+FiIfscY8U+K+2mXP+jtSq6jXKWhL9D0j BxKOhkEr6zxzzo1qb8kMH9doWj7RiZAyJdIBxOv6umWLoaxgTWtCqwFjv69+ggXYVqiq xbr8P/lAnUcz6LELnekTUhPzS4ezZnU0cjofHuoCtdLd/o7YVhvNXK6NZJJUfjHSdx+0 L3dQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=ylcUFohs; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=gmTCd6fH; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-80597-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id cp1-20020a170902e78100b001dc8fac925csi2301457plb.310.2024.02.25.22.42.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 22:42:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80597-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=ylcUFohs; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=gmTCd6fH; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-80597-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id EE2A1B21D0D for ; Mon, 26 Feb 2024 06:40:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B34F1AACB; Mon, 26 Feb 2024 06:40:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="ylcUFohs"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="gmTCd6fH" Received: from fhigh3-smtp.messagingengine.com (fhigh3-smtp.messagingengine.com [103.168.172.154]) (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 806B61BC40; Mon, 26 Feb 2024 06:40:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.154 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708929642; cv=none; b=eiBtsIEarS0h3TTCQhPdMxg2EL9W9orIrzL4w8tjJEByQpPTPQb2IfqD4gqp80513LSnxM0k2Xpm5dqv0YhEfiJgS5gxPIg6fVG9NgIcyaiY13BmB9vQX2JqeOwUdLoa/awJBDupEqTV9eQU+POsM2J21lj/jtxRM4iQ3LenAcg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708929642; c=relaxed/simple; bh=F6xS/sPDcnGi+LW5vTTRr/QxpEkulMQOTp4x7pE3ti0=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=u069j6tN3ycXt5XBqIiYgWumeXu+HQh52XUGbL7I52qJEI37Q7JeTy3pwk10fDqYDAVi7VNkAvmlAXocXF2Ydf8RfOukJ4oqmx7SeyAFcHiSSn5RbJ9xoU1J8S60Y2fMkzT5KskFvBCsDsCVQfMBujeeytdDk5mY3YNnDFr3rVo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de; spf=pass smtp.mailfrom=arndb.de; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b=ylcUFohs; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=gmTCd6fH; arc=none smtp.client-ip=103.168.172.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 8B7C911400D7; Mon, 26 Feb 2024 01:40:39 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Mon, 26 Feb 2024 01:40:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1708929639; x=1709016039; bh=niqg6Cmwj6 McOY6q6YOYSiG1lI/AhWSYhtFhttSI3+A=; b=ylcUFohsRpW2osobS1SzL9f43k cXbdks5YgERsk8w+AhIrJ2zch9vgDk54QpaMaGe0pfJHp5hnnLBon8Xsbab4w1Y4 FN5NcjA+9hEl13XKZLu+GMRpuPprgig/YEdrINFJYyafqa3BWOs06EkiEZydY3Mt bPuBHt7u5xEQhtn0iOPeUGKVICW5BkCs+4p4nrzI8B3ApGRMo744gxFuALOsxMG5 h+oJJZAR7XtaFiwvbtPIcWIDeCceBcpTqCZKJ+S5PSJoyzHvse8XmYlljwoqHKW0 /H/1vyvMAvIGdntsg571PK95qmZ58Z6cvrYLS3/q9KXe4GVRbXJ35sCrgMoQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1708929639; x=1709016039; bh=niqg6Cmwj6McOY6q6YOYSiG1lI/A hWSYhtFhttSI3+A=; b=gmTCd6fHyHCbMVnrMNr6SxbDZTN7HzIC2m+K3dXIpgHc XHfk6GFvhe8kYjkxun3dACk75dY+ItX0TdwlbCqF63azAUy0rY5MiSZ78bxocIQR U7KsYKMRTomwsogk7vdXeCmghYCHAmQUtP556dCgq/SyB4THh7GNGx2j3Xf+Oxpj 45wpKHmBdl1/kTP1GBIoGRFx/vBDWNTK3lfEGwEBudJ7+t+d5bOFUBsFPvcNpb7o Zq1T+u9/700HxYm92jrHsdaefk7JRbrcgotaMas4cTKbznhYo0w8tbKFAQhHhaeG BFj3IJA184GhqecEx25YUgf3lSKcQRBe7n7SwjJE9w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrgedugdelkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdetrhhn ugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrghtth gvrhhnpeevhfffledtgeehfeffhfdtgedvheejtdfgkeeuvefgudffteettdekkeeufeeh udenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomheprghrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 2013DB6008D; Mon, 26 Feb 2024 01:40:39 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-153-g7e3bb84806-fm-20240215.007-g7e3bb848 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: In-Reply-To: <20240225121929.2e3fdc1b@jic23-huawei> References: <20240224121140.1883201-1-arnd@kernel.org> <20240225121929.2e3fdc1b@jic23-huawei> Date: Mon, 26 Feb 2024 07:40:18 +0100 From: "Arnd Bergmann" To: "Jonathan Cameron" , "Arnd Bergmann" Cc: "Lars-Peter Clausen" , "Nathan Chancellor" , "Nick Desaulniers" , "Bill Wendling" , "Justin Stitt" , =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] iio: avoid fortify-string overflow error Content-Type: text/plain On Sun, Feb 25, 2024, at 13:19, Jonathan Cameron wrote: > On Sat, 24 Feb 2024 13:11:34 +0100 Arnd Bergmann wrote: > It's a false positive, but the compiler has no way to tell that only bits > 0 and 1 can be set. > https://lore.kernel.org/linux-iio/20240222222335.work.759-kees@kernel.org/ > for discussion on why + the missing zero initialization bug Kees noticed whilst > looking at this code. > > Kees proposed an alternative way to suppress the warning that I've just applied. > https://lore.kernel.org/linux-iio/20240223172936.it.875-kees@kernel.org/ Right, that's fine. > Your solution also works but leaves the implication of a real path to > overflow the buffer when there isn't one, hence I prefer what Kees had unless > some future version of clang trips over that in which case we can revisit. The idea with my patch was to make it obvious to the compiler that there can't be an overflow, which would ensure the warning doesn't come back. Kees' version works by avoiding whatever code path in the compiler trips over the warning, but it's more likely to come back later if something changes in the compiler itself, so there is a slight chance that we have it work around it again. Arnd