Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp3353rbb; Fri, 23 Feb 2024 09:51:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXaTlEDeTqNi5aTkCtOpHbNdzLqCsuSpv7aw5ewuj9gUhT6SFOis28QCQEPvznCXVOVTRL6LWkESaHuczns3j+KfXf0usLcPMrVhD3nOA== X-Google-Smtp-Source: AGHT+IGrd7NUzMNJ8gIOg8s/8v/M5F4nueta5HfbGCyQnFoPfjT67ntWRAVV4VLRD27BH+qle0f3 X-Received: by 2002:ac2:4959:0:b0:512:bf09:9313 with SMTP id o25-20020ac24959000000b00512bf099313mr345194lfi.50.1708710702009; Fri, 23 Feb 2024 09:51:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708710701; cv=pass; d=google.com; s=arc-20160816; b=y+yjPokwGf41+lA+ACLyafQYK/ErGT2b6TKPdCg91W3ArXOAXzlHDw+OFV6Mzw6QOv mpTulG3AGD23c0mUm6iKGtrNKGIMG/vFuiTjbY0z0IUAy0Eo1RobfXAgN2dd+DwBfoBm RITcwi5BAPzVJSL94/I7KkXPi/Ay6A+McQNMqFCvd7xqGubXZQUVwcMWTZp1VPx2rEdP ZxCduucoBeFtOg4Ol6Gb52CQu9XyBebGhuAE5JrH9hd7KTqNE7R0FJl5cE8aHnDdr3L6 oBgtRCvhG3duq3jPh3SvnrNAYDUdWQaKIA29+p9ryGgDpYsJHWH4eB9MdScnfeoEyNpQ o8FQ== 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=Fh8E4x68Izt4HceoSL2C5zjPW+nFmkMjm9Tr07dbTE4=; fh=/ZcsTjbGL6y8SpBeHgMuhS5gox8N7GyFE1EYiXUvcYM=; b=R75oNOSnUjwW0F/m1DRMHpc6rDFgs2P3QNYBlYGOrO+Hw0uKy/snRcTLWLCLwL7Pp2 YYVyAxGz31PX8Zd041W5DwhvPtbDYXiQ0hc8Zyp8iG+HgAc93FpDMAl0pDSUrotAFh5h 57sTTWxNesrenqlv0PG8RlEqiZh/o42KA89YQ184JPCaBswb0/q57IJXWZfw1v1bPI2L bw4/8SeWTwkl3jx8AUkGdpZBjmHFOIz1vKJyly3FEWtx81jcfeB10dC9vYEWXEbmoFBx RWSTq4AjflgheorUhPngjJYyR/7uMdE9kieM2v3nlsHZ4GU/HCY3J/8f2iSVy4AFvErC h6/Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XNfHMMyW; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-78916-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78916-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id q7-20020a17090622c700b00a3efce732ecsi3578959eja.379.2024.02.23.09.51.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:51:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78916-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XNfHMMyW; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-78916-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78916-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id CAFF01F22D9C for ; Fri, 23 Feb 2024 17:51:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F2FC13DBAF; Fri, 23 Feb 2024 17:50:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="XNfHMMyW" Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (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 88C39134CCA for ; Fri, 23 Feb 2024 17:50:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708710613; cv=none; b=oC6bsOb73JA/Q9tVU1VVqQqTIpNs+jjS+IEcYFiuCztArORVK5P2Vou0hLIs2vIGUssphji46OV50SzdLRVN6V3UVMFJWv1NverfRBZV2rEXlmf4r3FDFLgsPIwoZPbTvPc9PvUwsJHwZHOQgZGTHcyv+0rMjfirLJHYBhV4cPY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708710613; c=relaxed/simple; bh=CjG7WgCgFDAFL/tReNZpG/kD85Tt86MKrrUPD2AYLQk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GcLpkzPBPVkpS/sfgSx5ayZgKKcMKqjc9KfWPOwE3F1CkrN7PpuZPRA8iBdgWcww01UcKlYVB2sobv7wpuz5yn9TMI0d+r75K2sKdJ5NJHVuW35QIn/xx5hGdybSEPN1ygA+TtToyiLhSczWIuLgV0jPV/BX/JVJKZ3fBOqRsSs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=XNfHMMyW; arc=none smtp.client-ip=209.85.215.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-5cdbc4334edso787247a12.3 for ; Fri, 23 Feb 2024 09:50:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1708710611; x=1709315411; 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=Fh8E4x68Izt4HceoSL2C5zjPW+nFmkMjm9Tr07dbTE4=; b=XNfHMMyWWywPWp6ekMQN2xw5jYA2vu0lHbsC/j8YCsn+aQlDzdprJ3E6jhtEMi2o21 i42tsViP1d2CHrY5kkF9+W5IyGrSFhJYLbbkLDm5yHnSHLg75qJ+jsvGYMDIZ1qyqTIE uYVyL+TZTDVCWwUzkKosPaR/upLby1n5XNrKs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708710611; x=1709315411; 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=Fh8E4x68Izt4HceoSL2C5zjPW+nFmkMjm9Tr07dbTE4=; b=i8xHkknFIj/bEvbsASURA/x+8xo9XuuKxy4JBDVNSgl0HcynsDJKEntou4w7kSeEyQ UM/MnA0j7RIuio4eJcYrj0iwPhfJ3iBYqcwcX3u92Z4KMOPlsQiR+PxGMboHwqLDNQOg XORcfpgd51xn+lb6xKBbwmb31l0YfJiSlsMkpybXXQkxQB2EwfpCADtN+y8Wk5nSfQ22 x+qHeIucyie6pDtiszWt1ZuQvJQrAwOI8ybLibB1DpgmljNNYK+vp9ZXC9Jq+f259wZO Y806SKRWIa7DCSBA7rgsdbYSciSDuOeMt8jcMtkMtVrCbe+sFDBi6Dqp3e0vRYuLhOJX pcKw== X-Forwarded-Encrypted: i=1; AJvYcCUg5PLguLwm9kKnUxlKipCeijWh3Ec2rdPYz5YV/c2HgBoqNwYxVzgbA8TiUqSeOl30Kt6rRbdCUxuyjjAinmvLNZXsQ/5rlWgwXFOl X-Gm-Message-State: AOJu0YzGny1x7pQ/7lD+GCiOMIZx6AxdjJwhwc7t7sBBJWxwOg4c9vco zECxoez7HWK7x6GlBjwHjsyJUBBR4tpxcRFaH9/2JshWc09ADp2h/ktyDLF6Pg== X-Received: by 2002:a05:6a20:a901:b0:1a0:61e4:a940 with SMTP id cd1-20020a056a20a90100b001a061e4a940mr573533pzb.45.1708710610948; Fri, 23 Feb 2024 09:50:10 -0800 (PST) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id u2-20020a656702000000b005dc26144d96sm10977296pgf.75.2024.02.23.09.50.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:50:10 -0800 (PST) Date: Fri, 23 Feb 2024 09:50:10 -0800 From: Kees Cook To: Andy Shevchenko Cc: Jonathan Cameron , Lars-Peter Clausen , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Nuno =?iso-8859-1?Q?S=E1?= , linux-iio@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , llvm@lists.linux.dev, Tomislav Denis , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2] iio: pressure: dlhl60d: Initialize empty DLH bytes Message-ID: <202402230949.E06F3297@keescook> References: <20240223172936.it.875-kees@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: On Fri, Feb 23, 2024 at 07:47:36PM +0200, Andy Shevchenko wrote: > On Fri, Feb 23, 2024 at 09:29:39AM -0800, Kees Cook wrote: > > 3 bytes were being read but 4 were being written. Explicitly initialize > > the unused bytes to 0 and refactor the loop to use direct array > > indexing, which appears to silence a Clang false positive warning[1]. > > ... > > > for_each_set_bit(chn, indio_dev->active_scan_mask, > > - indio_dev->masklength) { > > - memcpy(tmp_buf + i, > > + indio_dev->masklength) { > > + memcpy(&tmp_buf[i++], > > &st->rx_buf[1] + chn * DLH_NUM_DATA_BYTES, > > DLH_NUM_DATA_BYTES); > > - i++; > > } > > Not that I'm against the changes, but they (in accordance with the commit > message) are irrelevant to this fix. I prefer fixes to be more focused on > the real issues. Jonathan, let me know if you'd prefer I split this patch... -- Kees Cook