From patchwork Fri Jun 22 23:15:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10483279 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9C251602CB for ; Fri, 22 Jun 2018 23:16:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B0A229065 for ; Fri, 22 Jun 2018 23:16:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FF272906A; Fri, 22 Jun 2018 23:16:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2693229065 for ; Fri, 22 Jun 2018 23:16:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2238E81111; Fri, 22 Jun 2018 23:16:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2B1A20155E0; Fri, 22 Jun 2018 23:16:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9ACBA4A469; Fri, 22 Jun 2018 23:16:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5MNFvoo029998 for ; Fri, 22 Jun 2018 19:15:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id D2F1E7B8D8; Fri, 22 Jun 2018 23:15:57 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E4CB07C756; Fri, 22 Jun 2018 23:15:55 +0000 (UTC) Received: from smtp2.provo.novell.com (smtp2.provo.novell.com [137.65.250.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DD45F3082123; Fri, 22 Jun 2018 23:15:54 +0000 (UTC) Received: from apollon.suse.de.de (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (TLS encrypted); Fri, 22 Jun 2018 17:15:50 -0600 From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Date: Sat, 23 Jun 2018 01:15:16 +0200 Message-Id: <20180622231516.18806-6-mwilck@suse.com> In-Reply-To: <20180622231516.18806-1-mwilck@suse.com> References: <20180622231516.18806-1-mwilck@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 22 Jun 2018 23:15:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 22 Jun 2018 23:15:55 +0000 (UTC) for IP:'137.65.250.81' DOMAIN:'smtp2.provo.novell.com' HELO:'smtp2.provo.novell.com' FROM:'mwilck@suse.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 137.65.250.81 smtp2.provo.novell.com 137.65.250.81 smtp2.provo.novell.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Eli Qiao , Martin Wilck Subject: [dm-devel] [PATCH 6/6] libmultipath: fix gcc 8.1 "truncated output" warnings X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 22 Jun 2018 23:16:29 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP gcc 8.1 was warning about a possibly truncated output in snprintf. Signed-off-by: Martin Wilck --- libmultipath/sysfs.c | 4 ++-- libmultipath/util.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c index 16e0a737..b7dacaad 100644 --- a/libmultipath/sysfs.c +++ b/libmultipath/sysfs.c @@ -239,7 +239,7 @@ sysfs_get_size (struct path *pp, unsigned long long * size) int sysfs_check_holders(char * check_devt, char * new_devt) { unsigned int major, new_minor, table_minor; - char path[PATH_SIZE], check_dev[PATH_SIZE]; + char path[PATH_MAX], check_dev[PATH_SIZE]; char * table_name; DIR *dirfd; struct dirent *holder; @@ -256,7 +256,7 @@ int sysfs_check_holders(char * check_devt, char * new_devt) condlog(3, "%s: checking holder", check_dev); - snprintf(path, PATH_SIZE, "/sys/block/%s/holders", check_dev); + snprintf(path, sizeof(path), "/sys/block/%s/holders", check_dev); dirfd = opendir(path); if (dirfd == NULL) { condlog(3, "%s: failed to open directory %s (%d)", diff --git a/libmultipath/util.c b/libmultipath/util.c index 7251ad08..aff74281 100644 --- a/libmultipath/util.c +++ b/libmultipath/util.c @@ -329,7 +329,7 @@ setup_thread_attr(pthread_attr_t *attr, size_t stacksize, int detached) int systemd_service_enabled_in(const char *dev, const char *prefix) { - char path[PATH_SIZE], file[PATH_SIZE], service[PATH_SIZE]; + char path[PATH_SIZE], file[PATH_MAX], service[PATH_SIZE]; DIR *dirfd; struct dirent *d; int found = 0; @@ -356,7 +356,7 @@ int systemd_service_enabled_in(const char *dev, const char *prefix) p = d->d_name + strlen(d->d_name) - 6; if (strcmp(p, ".wants")) continue; - snprintf(file, PATH_SIZE, "%s/%s/%s", + snprintf(file, sizeof(file), "%s/%s/%s", path, d->d_name, service); if (stat(file, &stbuf) == 0) { condlog(3, "%s: found %s", dev, file);