Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp449145lqt; Thu, 6 Jun 2024 08:14:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU0LKlmGd8z0Z8d2K/2BbPAMxTG4Hg6evGgepcWnAHsbpm3FThmPjSid1RDzhAB7IH0V7yfFAajEd3Nxv9YYIoIzgPhAW2jZ3W/DffJUg== X-Google-Smtp-Source: AGHT+IHYThP9O/sQvecRN9Ue9EDXeRvEmuhH7p0f/Co13r9AYbHr9nSUPPkDrTIn8CG9J/+UBgBn X-Received: by 2002:a05:6a20:3d95:b0:1af:6428:1812 with SMTP id adf61e73a8af0-1b2c55ae446mr4214040637.4.1717686843722; Thu, 06 Jun 2024 08:14:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717686843; cv=pass; d=google.com; s=arc-20160816; b=lnXr5xypRbJ/JUM/PH2v+60C2Fo+sQdnFJgYPIfegZUR1bP7iqQeSiSynhepU8vEAE 5YEW+aQD3O/zwFeJnVY8QLybof+tDxoMUhE1yygwubQ+HZeglrb2FhHg7npnXiazM6DQ FONTmuZD7AIDgRuLnZc5uKmkE+l8sNikudmk53tLNh8swT0oDdt3gJmVNafb9h6OD3eD Eq/i5wwLnfJKNHuK0G28la/+ykqLeQn5YdgHMtNSOSl22VkdwCqjzZgo6K6bKR5TBCAf Aoam+TDGZWzjmFcDoYquL78V/+A4I3YF/G4JzKaDpA32bKgqCQsugNIZOPjkzSH3uumF FZWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=70fWmUokzUaTAt7lHepUuO1dQ4W5R4Ym+y+Xa+vFiRU=; fh=mfXiHNpwdk/p0NQPZ5Rw7C8FDAn/hixbQMPYnUkCkzI=; b=qiCBOZ+ysCZyBUZcDLI8+SMITM2aFHs7T00Kh/5RteXNk60XLW523diSlOxVD//FsD dwHBzmMkmktG/oHyM7izYUUh4D1aXqVVnAlBDRdgQbbd4Aw4dAdnWemysBWWtUt0gqbj dqtc8kTiaexfYVLLUKomru1OjKSFcrR+0de7OIf3jVVjUQmHE0moVxmX/S2PMdob3nIS X5PgBa4KgbpujKc1DleP+aC6Cqj/BP3CVGEniQCllh1J8D1jo0b6MvxkCB7IKwTtEJQr gg2SKbtbyfTo5KfPcNPWdz3LOZ0IZmh/AvIkuzNZB1Rjzm+Ku0B8kFncqncM0KUsP3pD qQlQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=VcWpyeBg; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net dmarc=pass fromdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-204477-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204477-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=weissschuh.net Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de2895b245si1331440a12.627.2024.06.06.08.14.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 08:14:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204477-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=VcWpyeBg; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net dmarc=pass fromdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-204477-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204477-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=weissschuh.net 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id CC79028B36E for ; Thu, 6 Jun 2024 14:57:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D27BC1AC253; Thu, 6 Jun 2024 14:30:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="VcWpyeBg" Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 5FB9319AD5E; Thu, 6 Jun 2024 14:30:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717684234; cv=none; b=WhG6gWwzDXjEGqN6XhrfENbwBIhTssCXVmgozwuGayXyTqfRjSpOLHXP7ZAFg5MeKyc6xvLMd5FOIWuOjhel+p5C5NfDOEu5LnvIONVGzist3NhUva0fpSmoJx4+PA4crUy/OwOzwv/gRRCjh7K8rcUCdr4+y438yFG8oZjXTn8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717684234; c=relaxed/simple; bh=OvnfEQO/21Hp0O519uSBy/WK6+BMymWF8Iu1zCEidYM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=u0BTaiOUVjpymH44olCgFH1wZcYUkZCRr5GbUAQWBsYydhbUA2YT5gKiLw3zT1jgPjJS87zanlGIE78WFjgubM1kPLBJjwO7TXv0lGegOWVfIfebjDNFpDde6sThutxSJozD403h7U42hd5rI76Z51PgtSwzHz6AC618dBeP/xk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=VcWpyeBg; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1717684225; bh=OvnfEQO/21Hp0O519uSBy/WK6+BMymWF8Iu1zCEidYM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VcWpyeBgOqzYo+lhsjYvWrRoBs+s2FGG7fSBHO8oAWErIz93Glkzhc8QScYlhq0gB ZQ0AZgvBNHbdLqrtRPTr4UpzwlSvkT2zVYDFiohgrZukOfIw392Ex50103HHRg5par qspoKxIu9dIkPl8xmUGkCvGtpUwbI4Y701sUsPEA= Date: Thu, 6 Jun 2024 16:30:25 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Dan Carpenter Cc: Jean Delvare , Guenter Roeck , Benson Leung , Tzung-Bi Shih , chrome-platform@lists.linux.dev, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] hwmon: (cros_ec) Prevent read overflow in probe() Message-ID: References: <42331b70-bd3c-496c-8c79-3ec4faad40b8@moroto.mountain> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <42331b70-bd3c-496c-8c79-3ec4faad40b8@moroto.mountain> Thanks! On 2024-06-06 16:12:11+0000, Dan Carpenter wrote: > The "resp.sensor_name" comes from cros_ec_cmd() and it hasn't necessarily > been NUL terminated. We had not intended to read past "sensor_name_size" > bytes, however, there is a width vs precision bug in the format string. > The format needs to be precision '%.*s' instead of width '%*s'. > Precision prevents an out of bounds read, but width is a no-op. > > Fixes: bc3e45258096 ("hwmon: add ChromeOS EC driver") > Signed-off-by: Dan Carpenter Acked-by: Thomas Weißschuh devm_kstrndup() would have been nice. Thomas