Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1013847yba; Thu, 4 Apr 2019 02:26:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMjpkSeZdc2z/2GrWO8J9KNC1+/BrU1mU6xNahAM35WhjYJqxdbcKsCCpiVhbosIwIQoQ/ X-Received: by 2002:a17:902:848d:: with SMTP id c13mr5217756plo.279.1554369993956; Thu, 04 Apr 2019 02:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554369993; cv=none; d=google.com; s=arc-20160816; b=fIhKpadaS63Pgv9XbDkF73HDrRzgEcP0Trtnw4T/Iz3CRAlUg4z0BGNyFHq7hHXGdH jYtNmceRqZx+zxZsmef7sTFDaoQJ0cEx1aZfd++J63KyJgbSdckr3dhbcGOkAJwaSIBP HtmjsBKGz5UlMh6GzruV/Ng2Citmyfyiw3pR3d2NFx1Lxop8nlINkm/IFJtQwpxCLN6H wD4y3XSRXmzAhmE0fVcmtucjEE+qnlhfN8gUa6ORVKAGMYdroD5o6zoynefFHAvZ6JSa fYGXkfkTSbGOXRA/lrmSusPHgnlnS+EjPv79dmWlXA4ug+kpEBkVqC646v8zsPaFxeHn 3kqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=k/m+5VDzQkRHhxlOEy4IPU8S+8PxSsqN25MoPJerZm4=; b=knHe1ULYyLZp5aRh4mjXm8lvP/hBO5fjsN+H2Z/iy4cYdKlH9+sySfBHSh/Kwm+Udt P6yYFWJfp0dZxbOV2Mmtke42ttBed20KtqNYJeqMzTsMjeh2qDsZLrLbv7zJQNjIV/ar q8ZipTuNRSILjCSA5h/ZNjdRZqjpRwo+IkFSupuJ5cDkeBFUMjA+UF3gtAKfWcaxLY5n AxVrrDKuXRAdKnZnqG/4qixzna6XEtxQi78Y/pX+trKM+ij769wl0xQBvn7CnvgnxT4u lpnTrlicVSEe9xTDDPhjUOkGSBlwiI8iCf3JCTbmyfmer9M1u862Q2XL34F4qlFFL4RM 2mZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XmAMYldv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j16si15617827pfa.197.2019.04.04.02.26.18; Thu, 04 Apr 2019 02:26:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XmAMYldv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733116AbfDDJNi (ORCPT + 99 others); Thu, 4 Apr 2019 05:13:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:53920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387580AbfDDJNd (ORCPT ); Thu, 4 Apr 2019 05:13:33 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9C9A92075E; Thu, 4 Apr 2019 09:13:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554369213; bh=ytLtpcReY4S64uU+tYvNBdmffJ6O+5DUoiQd4IAE3ak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XmAMYldvmarQpviNLP/ofeMXj5Z9XK3B/LKUMhZOHE4xICHGwyVUtgUXOxJrZyO5T lYqKNKA+cFX++XtPAy4pABxDqC/e7uPf5s9WiOh4bZVaFck8QQQFV46TgeeaofPUw8 xMIIwgmqjAKqmUc2P5SB74bgyQeuuFRFybWq7vyI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuah Khan , Sean Young , Sasha Levin Subject: =?UTF-8?q?=5BPATCH=205=2E0=20139/246=5D=20=3D=3FUTF-8=3Fq=3Fselftests=3A=3D20ir=3A=3D20fix=3D20warning=3A=3D20=22=25s=22=3D20directive=3D20=3F=3D=20=3D=3FUTF-8=3Fq=3Foutput=3D20may=3D20be=3D20truncated=3D20=3DE2=3D80=3D99=3D20directive=3D20output=3F=3D=20=3D=3FUTF-8=3Fq=3F=3D20may=3D20be=3D20truncated=3F=3D?= Date: Thu, 4 Apr 2019 10:47:19 +0200 Message-Id: <20190404084624.033038495@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084619.236418459@linuxfoundation.org> References: <20190404084619.236418459@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 5.0-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit ed675ed9da6d951322efd72d739d6b5ce1c18f02 ] Fix the following warning by sizing the buffer to max. of sysfs path max. size + d_name max. size. gcc -Wall -O2 -I../../../include/uapi ir_loopback.c -o ../tools/testing/selftests/ir/ir_loopback ir_loopback.c: In function ‘lirc_open’: ir_loopback.c:71:37: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 95 [-Wformat-truncation=] snprintf(buf, sizeof(buf), "/dev/%s", dent->d_name); ^~ In file included from /usr/include/stdio.h:862:0, from ir_loopback.c:14: /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 6 and 261 bytes into a destination of size 100 return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Shuah Khan Acked-by: Sean Young Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- tools/testing/selftests/ir/ir_loopback.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/ir/ir_loopback.c b/tools/testing/selftests/ir/ir_loopback.c index 858c19caf224..8cdf1b89ac9c 100644 --- a/tools/testing/selftests/ir/ir_loopback.c +++ b/tools/testing/selftests/ir/ir_loopback.c @@ -27,6 +27,8 @@ #define TEST_SCANCODES 10 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +#define SYSFS_PATH_MAX 256 +#define DNAME_PATH_MAX 256 static const struct { enum rc_proto proto; @@ -56,7 +58,7 @@ static const struct { int lirc_open(const char *rc) { struct dirent *dent; - char buf[100]; + char buf[SYSFS_PATH_MAX + DNAME_PATH_MAX]; DIR *d; int fd; -- 2.19.1