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
This commit is contained in:
parent
2d7e563c39
commit
2c385d51ce
@ -1050,16 +1050,16 @@ g_handleattr(struct bio *bp, const char *attribute, const void *val, int len)
|
||||
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)
|
||||
|
@ -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();
|
||||
|
@ -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_meta *sample)
|
||||
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;
|
||||
|
@ -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, struct g_class *mp,
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user