From patchwork Sun Jun 24 19:09:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10484781 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 661266019D for ; Sun, 24 Jun 2018 19:11:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 604D228858 for ; Sun, 24 Jun 2018 19:11:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54F0028885; Sun, 24 Jun 2018 19:11:03 +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 EFE5A28858 for ; Sun, 24 Jun 2018 19:11:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7BA8830C10F0; Sun, 24 Jun 2018 19:11:01 +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 4BB253001647; Sun, 24 Jun 2018 19:11:01 +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 03F2F4A46E; Sun, 24 Jun 2018 19:11:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5OJAtTQ022868 for ; Sun, 24 Jun 2018 15:10:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id AEA1B6048C; Sun, 24 Jun 2018 19:10:55 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C30019CB0; Sun, 24 Jun 2018 19:10:52 +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 672173086249; Sun, 24 Jun 2018 19:10:51 +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); Sun, 24 Jun 2018 13:10:40 -0600 From: Martin Wilck To: Christophe Varoqui , Bart Van Assche , Benjamin Marzinski Date: Sun, 24 Jun 2018 21:09:42 +0200 Message-Id: <20180624190944.27158-9-mwilck@suse.com> In-Reply-To: <20180624190944.27158-1-mwilck@suse.com> References: <20180624190944.27158-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.49]); Sun, 24 Jun 2018 19:10:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Sun, 24 Jun 2018 19:10:51 +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: -2.301 (RCVD_IN_DNSWL_MED, 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.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 08/10] 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.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Sun, 24 Jun 2018 19:11:01 +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 8d8fcc81..347af5b0 100644 --- a/libmultipath/util.c +++ b/libmultipath/util.c @@ -331,7 +331,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; @@ -358,7 +358,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);