From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 4253A3EF649 for ; Thu, 16 Jul 2026 09:47:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784195261; cv=none; b=p0b0iTlYTdzea2wph0gkxG7M3ddJNUUe7CWdGLyfJyyFKVOUTAHoFLOHD1NTYZfs5i4TZ2oDZaKjzQ7ZJuJaZ/hYWK1BcPq0FyFzX+04o6hpdpslk+OHJZRcokNRxsiEIE9NacRYsZw9QkfvZ1YtjmPCy9l7ba46dYwHn8ER9Mw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784195261; c=relaxed/simple; bh=YHL5UBqkfPqBDoGZ+jKSLy/TdRXx0baXPGVVs2nEMS0=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NU5PDIIhQWIYYqRUD2rW46MPNPSCd1QQCpFqFNqCp3KxTMmo84xQHgB4VlTPIeDVIGdAVg4Ik13dOAcrKFzmT7v+4//vkRtDipk6AQI9xY7pbZrccVLBbSEkkQY70BM28qHjJV03LZI1pOrztcfG4uqfa+Kjgk8hNysob6uXsNM= 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=PQOngWnK; arc=none smtp.client-ip=209.85.128.47 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="PQOngWnK" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-493e497643fso15121745e9.0 for ; Thu, 16 Jul 2026 02:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784195254; x=1784800054; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=EATbcA/UeCqQGueYQZR73FysbRfQo6WKFQyeV9kM5h8=; b=PQOngWnKB33HKYpGNngOMbX+zS0UvwfWBPmxhl8S0JmGWOTbmIEJeIYTd2MRbdYOng akJYQWGwE7r59GmgJ/RspUq/7eeHBZ4FUxQafhJiCekbaey7YzueoEpAZf80IXsBIPWY 5CoR0iR47qccC4zhkKD6yOS+GPKr1a6qkTU1zGlGejs+qlrlPYvg3V3lO2UkfIamqSIf tSjV4bRDV6+VPYHh3NaOX2dfmJrSV80ehblGScgqGNlJ4xvtc01nWSbXVsGzhYu0Kh5h GsX6cEPIK512tKWLlKvn388al385kl5Qa+dAzDqHOTIcvv+nQgk1pihDigf6Lmx5Iksi vX3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784195254; x=1784800054; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=EATbcA/UeCqQGueYQZR73FysbRfQo6WKFQyeV9kM5h8=; b=jHpgkshRp0ZILkH9i3RndTVaTbkZP9DySY0sHHqKvIW9wMmvSRAat4prS9cXoT/K8+ ObPJevrXE7YoQ8ayfmxX1k65VrOy3yRVu077i23ijiDAArna+qSvc5ZAV2JOPlkco/P+ ifdvnS3ZXy3+iBtqx4drVqzhTH9budDqwSvhooO2oM5AEV+3xQVnqH0JR9g/8HF6Ycb+ 9QFMB4zWzsAEIqZpGnaz0o23ul8N8RQMC1wlT4GQjOsNCeS0GlZM7wPAXVa1tN9pgqJu TtuLiLlMlfaaKV3dZA3KqvOUrDzHqUP0HosGHgKOJkYjwYO2yCKs/0ZP/wdg0baDox3K XFAQ== X-Forwarded-Encrypted: i=1; AHgh+RoRX5MKWA+XJ1EcKp6o07tnEz/ZLHimCxblNGM1zz8Ew7ZJped9RDUa0t0U+0jpSH7cKVC7gumvoJg9/p4=@vger.kernel.org X-Gm-Message-State: AOJu0YzCpaaUuGzCTXTWcBkUpuba6kReUszxJNCqCr9RYB7hZXL/Zci5 Gqtf8XgYmyZRD9kMQbldRkdjGS2zBglA82UemQfoOwyJni3ynCBddo2m X-Gm-Gg: AfdE7cnD0yqNE5k7bk1HPmiIxIqSfsYAQn79ScyajGSUebn0qjE5XLRgdUqrfYwAwGj BM9Bpq0g24f+n7+Drn/ZLx/Ol/C8OiztNBnedg1NQTKXlwed5nTL9P5bYgX1r+bchFa24lOo7iv YKex+QNzZHkPiJVjb88MgyrGdQ54TZa4zpUpLJK46N+q0+EAkcuyqz4NiuOJ/nOwGq1BVMQuFsD IYPGsG4LZNhOBzk4xCYFwdl1KLaGoPk9FhDl5OOLQ5E8ZNXdgassbzRE8Orv1ZOSa+JzcjX5kr9 encQ/6UhSAv7V/MBqX/nHVBHL3xw04y2R83BprwjUlRuERVkxLvqFAs1G83PK/t62TYuJMtokBl IDk7m0/A9vSKzBSOSvhbFu7akuG1Ad8vzubrga/cntyTt/dpVSCWsXNUjLU/CyYEBiJxExmjAVp GN0l6VeKpvAE2N7bH5E60kv7wDj4+zBgMdMj0VrNs= X-Received: by 2002:a05:600c:1d0e:b0:492:68bc:3237 with SMTP id 5b1f17b1804b1-493f88333c0mr222870085e9.32.1784195253691; Thu, 16 Jul 2026 02:47:33 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49541ebe625sm42927525e9.15.2026.07.16.02.47.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2026 02:47:33 -0700 (PDT) Date: Thu, 16 Jul 2026 10:47:32 +0100 From: David Laight To: Dan Carpenter Cc: Mohammad Davoudi , johan@kernel.org, elder@kernel.org, gregkh@linuxfoundation.org, rmfrfs@gmail.com, greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: greybus: Replace sprintf with sysfs_emit Message-ID: <20260716104732.7123b1cd@pumpkin> In-Reply-To: References: <20260715172858.17658-1-MDavoudi2011@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) 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-Transfer-Encoding: 7bit On Thu, 16 Jul 2026 00:31:35 +0300 Dan Carpenter wrote: > On Wed, Jul 15, 2026 at 05:28:58PM +0000, Mohammad Davoudi wrote: > > Replace sprintf() with sysfs_emit() in sysfs show functions. > > The sprintf() function is unaware of the PAGE_SIZE limit of the sysfs > > buffer, which can potentially lead to buffer overruns. sysfs_emit() > > is strictly designed for sysfs attributes and inherently protects > > against buffer boundaries. > > > > Signed-off-by: Mohammad Davoudi > > We're not applying this kind of patch in cases where sprintf is fine. > > Really, I never like commit messages which talk about "potential > buffer overruns". Is it a buffer overrun or not? If it's really > hard to figure out then say that "This code is really hard to figure > out and I suspect its fine but let's be safe." > > In this case the code is really simple and we can all see the original > code is fine just from reading the diff... And you also have to double-check that it is valid to call sysfs_emit() in that context. The call sequences aren't all that obvious and are difficult to verify. David > > regards, > dan carpenter > >