svn commit: r332070 - in head/sys/geom: . label raid
Sean Bruno
sbruno at FreeBSD.org
Thu Apr 5 13:56:41 UTC 2018
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 <sys/systm.h>
#include <sys/time.h>
#include <sys/clock.h>
+#include <sys/disk.h>
#include <geom/geom.h>
#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 <sys/mutex.h>
#include <sys/systm.h>
#include <sys/taskqueue.h>
+#include <sys/disk.h>
#include <geom/geom.h>
#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);
More information about the svn-src-all
mailing list