From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 EEADA36A374 for ; Thu, 28 May 2026 08:59:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779958801; cv=none; b=C7gNy9IUu9/3ImCVHbKiv2mbvvP+DDB/10tHLa2r2agPr1yLYPDRD8MCRBpDUOH3A13bVJ4BhmBoV/nr3sZpsIGKHcfCZPWU8hL/0Xh5WtJw8URxaGr/2YOlOIuBtRAe1UvyXCFqK6aL7DF1Jf+4/zM20aYeCYdFRXWyQ7O+H/o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779958801; c=relaxed/simple; bh=PvJzGSkleW56Vujfk2IxYFkzTxjlsh1WeVJw7raldzU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=W9te5lh5TYexmktP57TkIzDlJSM95hfqSfJ5HY7xXzCEuR9zrf/rc5iMlWdih+OF/DMzYAeHY3nWe8eSmSOcrw4j5pUFKc+kgDiYANh4t3MIN8oCVAV1SrToleR9O4UBj9SWsynOGJGTRAWBwLotsE+Gc2ks+fGjVdtc1tRhgbw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=n9KNIb7Q; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="n9KNIb7Q" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4908b92904fso6823035e9.0 for ; Thu, 28 May 2026 01:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779958798; x=1780563598; 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=KgapLk0U8W9ohmKNOKBlmGBZxDjWC3tsNDHbpGJHrbQ=; b=n9KNIb7Ql9HC/XN/49KEIX5SU7f2d6ndMzWAj0Us4jRm75ZD152VgY3M0zvjH2XrP4 R2TtEyNkyJCfRq3SObVZ+EFNAsu50qCvZluNzMmQn7NulqT4Kf1XudXZN53A/jdbsENR raXNpnXJBM4KyUJNjvgRR5tBuN8+4pz6MKocdLKaF+SdCHNIWewQ1KKpWGmC2hK1Lu1E 9l+AH0Y1VWYNj95IM+PJfcCdwuJtESatW/Yg2FzwNrUPEOio6ma9Nc0AMiBLYDnGpb9W Sgq7h3UPxLxUzHfqEhoaJswqK9fdpnP0lDrj4XmhRbMWW5pfLxZsYeREi0Bf9HihvpHN qHpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779958798; x=1780563598; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KgapLk0U8W9ohmKNOKBlmGBZxDjWC3tsNDHbpGJHrbQ=; b=de5ykMvC55pTwOnBnsPhPhY9tcrxP8M1jsT+eIvjnOjFzJ0uNnucFb82iBHhG0wg1W clHisSz68EWW2NOegX19G1OH894e/4zZKWzpwvAZshOHhJLTkp6fHEmjCM0yY6KP+M3o /ayKpWE5CJAfFJyCw5h8+Twe3R95d0hqWSHaDSnuWRyV4ZxSOGudZMiCBYyXXNWggSeX K8pi/McAb7v6psvLtdlaFaYiz4agZqczldaULMWfue12fd9svQ+E4pXhzNBuRgOVcY+j SBnqZslBXrFAPEaDYCBTB+432jDJihOYSAVPbQzNj64E3WMbICNtAHkvGl5yE+ce/kVa Qq5g== X-Forwarded-Encrypted: i=1; AFNElJ92COjGZWUfQk1Xrtb7PXVo3H0bQZsltDPXqJaIJ3i0DTRq0y4KeEFGFAf2/XAZby2oZVHLpf/kpbVjteI=@vger.kernel.org X-Gm-Message-State: AOJu0Yynu4tVlJ4oWvxusU0+HBMXx2AZOpzkEUm+e0WnJz+DvAbO7dRF VUkn9CavPThLnmb+8pRzkna2tJtVxmBIpOe9LW/anOZa9B9IlmhnCAvp X-Gm-Gg: Acq92OGZ0FvKAO0o6is/yjLTlReWBbj5RfxMtNAtcD9mAx7dpSKYBDxYHAZMmo8mYtn 3e9tZsbmjpLy3aHilE7ptT1lwP0m/At5YPSkst3dszmCj3ZgeOrrOP5LcqAarHQkGprThwfOCEb kH1JXjiECKAuHyeogYuzK3aeKwY4ex17Ln9njtIomHCM7VETAyMdnV3NdKnKTUVjhYUuQlknV5n 9za2W6umD+R1AK/gChu8jUby67++DNJuK7dAxvd7CZZ+mRtNoo8frlI8Y5Nz1FLl+O7h3kCpyoi y36Ft9rRisbzqmu94xGthZ0Z5Yc3ZLw5lnWyJyHpe2OFtl3k62qZe5mBGd6+xxrH9Or1F8lCkI7 5E6XaVF61P2Hm7kqdy26Jwgu1IHVKtASGAqc9tkGZh+DmendlvEWSpPc6Rjp5chfFUcERtfrAMd Kh+ruym5uyRXdG5ljcYJn69etFDiAisxyQWg== X-Received: by 2002:a05:600c:35cf:b0:48a:5c23:cab with SMTP id 5b1f17b1804b1-490426bc737mr484669565e9.19.1779958797723; Thu, 28 May 2026 01:59:57 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49091d55972sm26972035e9.0.2026.05.28.01.59.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 May 2026 01:59:57 -0700 (PDT) Date: Thu, 28 May 2026 11:59:53 +0300 From: Dan Carpenter To: Sean Anderson Cc: Laurent Pinchart , Tomi Valkeinen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Michal Simek , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] drm: zynqmp_dp: Fix uninitialized variable in debugfs() Message-ID: References: <935aaec5-5417-3cde-f944-3c04ffbd3458@linux.dev> <9189701d-168e-1e63-8a6c-f6926029c336@linux.dev> 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: <9189701d-168e-1e63-8a6c-f6926029c336@linux.dev> On Thu, May 28, 2026 at 04:00:53AM -0400, Sean Anderson wrote: > On 5/28/26 02:18, Dan Carpenter wrote: > > On Wed, May 27, 2026 at 08:31:59PM -0400, Sean Anderson wrote: > > > On 5/25/26 03:16, Dan Carpenter wrote: > > > > If the *ppos is non-zero then simple_write_to_buffer() will not > > > > initialize the start of the buf[] buffer. It doesn't really make sense > > > > to allow non-zero values for *ppos, so check for that at the start and > > > > return -EINVAL. > > > > > > non-zero ppos seems to be handled properly by simple_write_to_buffer. > > > > > > > It's not an overflow bug, it's an uninitialized variable bug. > > > > The simple_write_to_buffer() is designed to handle partial writes so it > > leaves the first "written" (scare quotes) part of the string as is. But > > in this case, we can't handle a partial write and the first part of > > buf[] is left uninitialized. > > > > https://staticthinking.wordpress.com/2026/05/23/simple_write_to_buffer-is-complicated/ > > OK, that's a bit strange. Can you add this to the doc comment? I certainly > missed it when looking around for appropriate functions. > > And I like the explicit copy_from_user variant better, especially since > we are setting the nul-terminator anyway. > > > Also this appears to be dead code since fops_zynqmp_dp_pattern is never > > used. > > It's of course used in zynqmp_dp_bridge_debugfs_init. Ah, yes. I just did a git grep and the CREATE_FILE() macro confused me. But obviously this wouldn't compile if we had an unused local variable. Duh... regards, dan carpenter