From owner-svn-src-all@freebsd.org Thu Apr 5 13:56:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33D47F87400; Thu, 5 Apr 2018 13:56:41 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D46787CF72; Thu, 5 Apr 2018 13:56:40 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD8CE237EF; Thu, 5 Apr 2018 13:56:40 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w35DueDw022534; Thu, 5 Apr 2018 13:56:40 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w35Duexg022529; Thu, 5 Apr 2018 13:56:40 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201804051356.w35Duexg022529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 5 Apr 2018 13:56:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332070 - in head/sys/geom: . label raid X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: in head/sys/geom: . label raid X-SVN-Commit-Revision: 332070 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2018 13:56:41 -0000 Author: sbruno Date: Thu Apr 5 13:56:40 2018 New Revision: 332070 URL: https://svnweb.freebsd.org/changeset/base/332070 Log: Squash error from geom by sizing ident strings to DISK_IDENT_SIZE. Display attribute in future error strings and differentiate g_handleattr() error messages for ease of debugging in the future. "g_handleattr: md1 bio_length 24 strlen 31 -> EFAULT" Reported by: swills Reviewed by: imp cem avg Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14962 Modified: head/sys/geom/geom_subr.c head/sys/geom/label/g_label_disk_ident.c head/sys/geom/raid/md_ddf.c head/sys/geom/raid/md_intel.c Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Thu Apr 5 13:39:53 2018 (r332069) +++ head/sys/geom/geom_subr.c Thu Apr 5 13:56:40 2018 (r332070) @@ -1050,16 +1050,16 @@ g_handleattr(struct bio *bp, const char *attribute, co bzero(bp->bio_data, bp->bio_length); if (strlcpy(bp->bio_data, val, bp->bio_length) >= bp->bio_length) { - printf("%s: %s bio_length %jd len %zu -> EFAULT\n", - __func__, bp->bio_to->name, + printf("%s: %s %s bio_length %jd strlen %zu -> EFAULT\n", + __func__, bp->bio_to->name, attribute, (intmax_t)bp->bio_length, strlen(val)); error = EFAULT; } } else if (bp->bio_length == len) { bcopy(val, bp->bio_data, len); } else { - printf("%s: %s bio_length %jd len %d -> EFAULT\n", __func__, - bp->bio_to->name, (intmax_t)bp->bio_length, len); + printf("%s: %s %s bio_length %jd len %d -> EFAULT\n", __func__, + bp->bio_to->name, attribute, (intmax_t)bp->bio_length, len); error = EFAULT; } if (error == 0) Modified: head/sys/geom/label/g_label_disk_ident.c ============================================================================== --- head/sys/geom/label/g_label_disk_ident.c Thu Apr 5 13:39:53 2018 (r332069) +++ head/sys/geom/label/g_label_disk_ident.c Thu Apr 5 13:56:40 2018 (r332070) @@ -49,7 +49,7 @@ static void g_label_disk_ident_taste(struct g_consumer *cp, char *label, size_t size) { struct g_class *cls; - char ident[100]; + char ident[DISK_IDENT_SIZE]; int ident_len, found, i; g_topology_assert_not(); Modified: head/sys/geom/raid/md_ddf.c ============================================================================== --- head/sys/geom/raid/md_ddf.c Thu Apr 5 13:39:53 2018 (r332069) +++ head/sys/geom/raid/md_ddf.c Thu Apr 5 13:56:40 2018 (r332070) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "geom/raid/g_raid.h" #include "geom/raid/md_ddf.h" @@ -572,7 +573,7 @@ ddf_meta_create(struct g_raid_disk *disk, struct ddf_m off_t anchorlba; u_int ss, pos, size; int len, error; - char serial_buffer[24]; + char serial_buffer[DISK_IDENT_SIZE]; if (sample->hdr == NULL) sample = NULL; Modified: head/sys/geom/raid/md_intel.c ============================================================================== --- head/sys/geom/raid/md_intel.c Thu Apr 5 13:39:53 2018 (r332069) +++ head/sys/geom/raid/md_intel.c Thu Apr 5 13:56:40 2018 (r332070) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "geom/raid/g_raid.h" #include "g_raid_md_if.h" @@ -1450,7 +1451,7 @@ g_raid_md_create_intel(struct g_raid_md_object *md, st static int g_raid_md_get_label(struct g_consumer *cp, char *serial, int serlen) { - char serial_buffer[24]; + char serial_buffer[DISK_IDENT_SIZE]; int len, error; len = sizeof(serial_buffer);