Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp502593rdg; Thu, 12 Oct 2023 11:44:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHM1Sl9MStlL0GISfOeSjKgxJNF74xBSxsMBUbdEdJPF66n8jhGp9NSCzItLqzy+yPApOw X-Received: by 2002:a17:90a:af86:b0:277:4be4:7a84 with SMTP id w6-20020a17090aaf8600b002774be47a84mr32772596pjq.19.1697136272442; Thu, 12 Oct 2023 11:44:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697136272; cv=none; d=google.com; s=arc-20160816; b=Ef1GxfdY9kLJ4fKcjIQrxJ3eIm27asY1C1+3FaIccpAxJcDkd9idqLwSUGTM2LqePd xf4Pzv52Xh1Xg5t6RWm3RbYlkh+rNhZz2+pzOptFufFAb1B9KmZfzVxU7IVcEbyt2QUy 9Onbci6slxzhIC2DJgn8jrluFg9qGo3p6+gxcgqnUeJcjdG1vqrGUROFtfsd/4auw1xl ekadwULmvPKlxgnBzzQmYAy4Lyv83ZqbazwNI2kXgaDdUHO7GkNFDvZ7DniYgpH/S3sY zTsh8xef1RmFAhhu7BUTIZXXvEerJZgEyvOYG8SyhRR9HOKzkDrrPKlwrhuGFU/b5LuS woTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=p4IJk1jfPpuOdOgu2MQ79rc62trZiN8Vjveo+Rkj3n8=; fh=AzCX//G+255O8a10y5F1hb1p6OqztEaGEunIxgTrW/w=; b=HwDurKeR8qiGw32aZv1y3K0MBpkhUpxZIqQt265YYi0cPhyJomCHepWoIrY2rlFABL deWSc0Sdgpm2QCQPvqaQ7R+KmYTH1gOvTY39b1RRCIryTQwKZ9ftN4otsKfS49KxSByr AMyq8xDm0viNjtuDdQDC/1n47XAzCNvsw//Jr/TE0Dewe+Pg3W84mg3T6u0fbteY+aru BOdt5SMMpmv1gqkLE4r9IGL+NA1bT1ysSqyumJmm/sK6JYB9gYfh1HPugzYSwgvwcNo/ f+ygdavssRFa/CAjrbHVWhiGqG3CPryDh3PHj4yYa+S5AHQAQ7uVDlfvsH1SDhhDiNeh uyBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=AKlfPe08; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id ne6-20020a17090b374600b0027d12ed9e08si2671394pjb.106.2023.10.12.11.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 11:44:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=AKlfPe08; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id BF544831F7F2; Thu, 12 Oct 2023 11:44:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442009AbjJLSnx (ORCPT + 99 others); Thu, 12 Oct 2023 14:43:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441821AbjJLSnw (ORCPT ); Thu, 12 Oct 2023 14:43:52 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABC1283; Thu, 12 Oct 2023 11:43:50 -0700 (PDT) Date: Thu, 12 Oct 2023 18:43:48 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697136229; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p4IJk1jfPpuOdOgu2MQ79rc62trZiN8Vjveo+Rkj3n8=; b=AKlfPe08Yy4RsKr4WM2S3srzCwWroJ9Ia6/m7q+ozav+tOhuh0An18eiiAA3++NnikGsS7 eDkPnmV6JbElCr0+/nTuiQvEqZjrUaEQ/X1ol7gg2g+TCHh54NPkrNX+zadgYNJOe50BxY kDrdQJQIfLiPqnsvR1XzD1dTOsPQK+hfVtT5KinupYLJjUwoOqU429EURKbvTn3Er5Lfph fdqgLFHttslPMO7rqJK2rjRIPu/Z1TjmyQ+MUtToqB6daT/veQA4Eu8cGHb4LA9Ynvk6K9 senVMjyAGQi146PI3lVFrRbtfBJ0uUzXvuFYB/GXWtK8wirmOSsl562Cxj5yvg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697136229; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p4IJk1jfPpuOdOgu2MQ79rc62trZiN8Vjveo+Rkj3n8=; b=uXdWhs3zJjoS98UVypG+XxK78H+hUwUtvjLaiD9BP4FqE3mdi97hDK2KO7/ia7Z7MMA4vt U9VJD2muECZ6goAA== From: "tip-bot2 for Lucy Mielke" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] locking/lockdep: Fix string sizing bug that triggers a format-truncation compiler-warning Cc: Lucy Mielke , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <169713622853.3135.11510940240910538539.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 12 Oct 2023 11:44:30 -0700 (PDT) The following commit has been merged into the locking/core branch of tip: Commit-ID: ac8b60be078abebc3ab8836f3f0ecac6980e0b4f Gitweb: https://git.kernel.org/tip/ac8b60be078abebc3ab8836f3f0ecac6980e0b4f Author: Lucy Mielke AuthorDate: Thu, 12 Oct 2023 12:44:32 +02:00 Committer: Ingo Molnar CommitterDate: Thu, 12 Oct 2023 20:37:59 +02:00 locking/lockdep: Fix string sizing bug that triggers a format-truncation compiler-warning On an allyesconfig, with "treat warnings as errors" unset, GCC emits these warnings: kernel/locking/lockdep_proc.c:438:32: Warning: Format specifier '%lld' may be truncated when writing 1 to 17 bytes into a region of size 15 [-Wformat-truncation=] kernel/locking/lockdep_proc.c:438:31: Note: Format directive argument is in the range [-9223372036854775, 9223372036854775] kernel/locking/lockdep_proc.c:438:9: Note: 'snprintf' has output between 5 and 22 bytes into a target of size 15 In seq_time(), the longest s64 is "-9223372036854775808"-ish, which converted to the fixed-point float format is "-9223372036854775.80": 21 bytes, plus termination is another byte: 22. Therefore, a larger buffer size of 22 is needed here - not 15. The code was safe due to the snprintf(). Fix it. Signed-off-by: Lucy Mielke Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/ZSfOEHRkZAWaQr3U@fedora.fritz.box --- kernel/locking/lockdep_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c index 15fdc7f..e2bfb1d 100644 --- a/kernel/locking/lockdep_proc.c +++ b/kernel/locking/lockdep_proc.c @@ -440,7 +440,7 @@ static void snprint_time(char *buf, size_t bufsiz, s64 nr) static void seq_time(struct seq_file *m, s64 time) { - char num[15]; + char num[22]; snprint_time(num, sizeof(num), time); seq_printf(m, " %14s", num);