Date: Thu, 21 Apr 2016 10:09:48 -0700 From: Ngie Cooper <yaneurabeya@gmail.com> To: Alan Somers <asomers@freebsd.org> Cc: "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Subject: Re: svn commit: r298420 - head/sys/geom Message-ID: <CAGHfRMBm5RtfC8qk17snHvzEDchh0miizWOqR1srH_cFt7rb9Q@mail.gmail.com> In-Reply-To: <CAGHfRMCj5zQUHddyoY8Vn2qxJyjV7sUHYDK%2B0Jg2SCCiFX6_Sw@mail.gmail.com> References: <201604211643.u3LGhFpR057982@repo.freebsd.org> <CAGHfRMCj5zQUHddyoY8Vn2qxJyjV7sUHYDK%2B0Jg2SCCiFX6_Sw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Apr 21, 2016 at 10:08 AM, Ngie Cooper <yaneurabeya@gmail.com> wrote: > On Thu, Apr 21, 2016 at 9:43 AM, Alan Somers <asomers@freebsd.org> wrote: >> Author: asomers >> Date: Thu Apr 21 16:43:15 2016 >> New Revision: 298420 >> URL: https://svnweb.freebsd.org/changeset/base/298420 >> >> Log: >> Notify userspace listeners when geom disk attributes have changed >> >> sys/geom/geom_disk.c: >> disk_attr_changed(): Generate a devctl event of type GEOM:<attr> for >> every call. >> >> MFC after: 4 weeks >> Sponsored by: Spectra Logic Corp >> Differential Revision: https://reviews.freebsd.org/D5952 >> >> Modified: >> head/sys/geom/geom_disk.c >> >> Modified: head/sys/geom/geom_disk.c >> ============================================================================== >> --- head/sys/geom/geom_disk.c Thu Apr 21 16:33:42 2016 (r298419) >> +++ head/sys/geom/geom_disk.c Thu Apr 21 16:43:15 2016 (r298420) >> @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); >> #include <sys/kernel.h> >> #include <sys/sysctl.h> >> #include <sys/bio.h> >> +#include <sys/bus.h> >> #include <sys/ctype.h> >> #include <sys/fcntl.h> >> #include <sys/malloc.h> >> @@ -839,11 +840,14 @@ disk_attr_changed(struct disk *dp, const >> { >> struct g_geom *gp; >> struct g_provider *pp; >> + char devnamebuf[128]; > > Why 128? Also, why not sbuf? > >> gp = dp->d_geom; >> if (gp != NULL) >> LIST_FOREACH(pp, &gp->provider, provider) >> (void)g_attr_changed(pp, attr, flag); >> + snprintf(devnamebuf, 128, "devname=%s%d", dp->d_name, dp->d_unit); > > Why not sizeof(devnamebuf) ? Also: this doesn't NUL terminate devnamebuf; it really should (otherwise, boom... crash in geom)...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGHfRMBm5RtfC8qk17snHvzEDchh0miizWOqR1srH_cFt7rb9Q>