From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 73AB8490BF3 for ; Wed, 19 Aug 2026 18:16:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787163400; cv=none; b=Tiuvv7cr6eSsDcXF8MpGt3vT/RdFSii1IRUWGI+kEFeRc3MT5lsLRB2k4eZMCsTnVHpJJyXcOCN8RfudCKsSfxnot0N2QfgVkXWOvDkYrqmiQGdPsjIBVAKSFQ7QxYfAQ0VJHNcDbAJkSU+CAnwrs8D8gW4X20xc6hu0mJwW7dk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787163400; c=relaxed/simple; bh=HKbHUPzIF0sxOi/gVORJXE9q94etDqfM25thtSz+r3M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ac4wEba4SvkCizizyK3JDQEk5dHueZGY1NYBMSkI/HHBL90+U06umRJIJ/v+GbL9LEi7mYY3Rzikod+8RLLKa45/M2TgOEwMHB7HI35nbELjzi63xVpxOMB8W7YSchlXWcDAmIP6zFVycuLJtDwERNDITvUkBzHntlVIYp2Ijv0= 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=C6W1nhmX; arc=none smtp.client-ip=209.85.128.48 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="C6W1nhmX" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-490cf322ed0so11919315e9.1 for ; Wed, 19 Aug 2026 11:16:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787163397; x=1787768197; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=etwYCc0YG/dlWmj1ZdGEpwanMrLp6se5hTk1lCrdgCA=; b=C6W1nhmXK1z7evNKaoNA8GhjqIanTQAajfVpoN4npra32Ycdv358Elt0Q4VwuQDrvH cangDOizZVA89i7wYoLqgQS1rLL7sYGDe95FO9Lzm4XQ5rEaQsXAiV+kLrSeF2e4w+Ua KDPiTgM2XbPtnlJw1ZizAXvQU4O2eyadAS5+rs7HZsRhWgqXkQKhqmI0a2LIGCYMtUAA O08KE3IgtdhTY3JpwSFd66j2EeTOOUx4HwSjjFCV9dlxxKLY+nzme4YIuQj4qQOUgDXP VgP0I7/WdCQiFfcFh/9MQyR7qR8NwDg/cmnfl7Ce9vdi25fzVoeuEEdNT2ZHGye9T2fJ +eBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787163397; x=1787768197; h=in-reply-to:content-disposition:content-type: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 :content-type; bh=etwYCc0YG/dlWmj1ZdGEpwanMrLp6se5hTk1lCrdgCA=; b=OlS01amCwbFg+4/2+s37DhuyG8h5qVHjd+TGiMaxjR47NGIOmkfp8y/Twg0Ntf0rRi DsxwSQhQjvmSYGOVxZjO0xrFHBD5m9foHHQHNkS/GPobbkKoOn8dtcLhrCtGEqQe/bO6 co/l896+K9odMpOzf+DB9nwajvoF4uggc0adRLpL15YkbeFjecRql50LaunL9RBRs6LL atfxC8jpwmRW75IQ/VyLaujvND5aZ34cz+ymXK2Tlvogv4sBGK/ko6XRFI3NRa24ly5m wMNxsI6Ns8n895ld1WEkANe9ldlFGXRplysWq6ezwrN8FpdBLslKVPo3RHDIdElVO5y8 Iqkw== X-Forwarded-Encrypted: i=1; AHgh+RoLxPyl9VWmKUOX/yyjcDP70xPwJVR+5eEw1ljFVqtHqyvoLfMVGVX+ZLyHiy5SyXIPlE9g1F1NNva07xU=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6lwtEJk05yfLIzesDjBlAZQ+hIU0NmabaJY2aISe7HWOvlid2 W5tiOnxGX+35D34ATZHk45QEX4/u5gOzESe5tVTmJ/mpu7RatrG/K460 X-Gm-Gg: AR+sD12N2M+ErHJLYtJj9U2kPx1UfLwxtc//ovSVEMm4Uaht9IfZZD9xu8CjAtfhPJR tHXDDnRUjORNw5NmOFlefLNd6FalTzWumu6gxlr3UF52rLMplupsckaqwHVEya77N54FsRu3JPR ARFu1Y4t7eN/52Uour+DB6MGijF4gOfOncdVT/O9k2dxKD8VGq0dewAtrpFQRd9kUM3QkTLuWB+ nmLXGLxVlX8POFUInGNPp+Jd8RcpfEZ01bC6qhOQgtfjtB6juAbTilksmgxEJFnd0SCwebuqAMx S0RwCNKdP0H5ZjPKPYntsll9OWm84usTvuF8IZ1v0k2uRZbJHGfr0K7UDbd6phZjlF40FnDr9IV hygQfeN2nzK5xXN8+4oQc8iZVvjCezgmxw3gpbq7K7HDc9DZw9PMvWdUgpfDZYHgf+RZBsZtaXI giG7uwD817pXqZc7mYrEhwwtF/FYxMV6WAuhmkZ4feoN94WCmHcT23bAJp X-Received: by 2002:a05:600c:3590:b0:493:a966:d5b5 with SMTP id 5b1f17b1804b1-499aa14a75bmr129238445e9.2.1787163396476; Wed, 19 Aug 2026 11:16:36 -0700 (PDT) Received: from localhost ([2c0f:3d00:6be:8900:ce5e:9212:ea4b:f30]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-499a9e784b3sm67635045e9.3.2026.08.19.11.16.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Aug 2026 11:16:35 -0700 (PDT) Date: Wed, 19 Aug 2026 21:16:32 +0300 From: Dan Carpenter To: Tomasz Unger Cc: Andy Shevchenko , Greg Kroah-Hartman , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: fbtft: prefer scnprintf over sprintf in fbtft-core.c Message-ID: References: <20260819-fbtft-core-scnprintf-v1-1-842c0603634c.ref@yahoo.pl> <20260819-fbtft-core-scnprintf-v1-1-842c0603634c@yahoo.pl> 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: <20260819-fbtft-core-scnprintf-v1-1-842c0603634c@yahoo.pl> On Wed, Aug 19, 2026 at 06:44:44PM +0200, Tomasz Unger wrote: > Using sprintf has potential for buffer overflows if the formatted > string exceeds the destination buffer size. Replace it with > scnprintf, passing sizeof() of the fixed-size stack buffers > (text1[50] and text2[50]) so the write is always bounded. > > In practice an overflow is very unlikely here: text1 only needs I don't have a problem with the patch, because I think making the code easy to audit is helpful. However, change "unlikely" to "impossible". 18446744073709551616 KiB buffer memory 123456789 123456789 123456789 1234567890 spi-4294967296.-4294967296 at -4294967296 MHz 123456789 123456789 123456789 123456789 1234567890 The other thing is that scnprintf() is only for if we care about the return. Otherwise default to snprintf(). It's just a more traditional choice. regards, dan carpenter