Re: __progname in base
On Sat, Nov 07, 2015 at 12:20:42PM +0100, Tobias Stoeckmann wrote: > Index: bin/mt/mt.c > === > RCS file: /cvs/src/bin/mt/mt.c,v > retrieving revision 1.36 > diff -u -p -u -p -r1.36 mt.c > --- bin/mt/mt.c 12 Nov 2013 04:36:02 - 1.36 > +++ bin/mt/mt.c 7 Nov 2015 11:16:25 - > @@ -88,6 +88,8 @@ int _rmtmtioctop(int fd, struct mtop *c > struct mtget *_rmtstatus(int fd); > void _rmtclose(void); > > +extern char *__progname; > + > char *host = NULL; /* remote host (if any) */ > > int > @@ -133,7 +135,6 @@ _rmtclose(void) > #endif > } > > -char *progname; > int eject = 0; > > int > @@ -145,12 +146,7 @@ main(int argc, char *argv[]) > char *p, *tape, *realtape, *opts; > size_t len; > > - if ((progname = strrchr(argv[0], '/'))) > - progname++; > - else > - progname = argv[0]; > - > - if (strcmp(progname, "eject") == 0) { > + if (strcmp(__progname, "eject") == 0) { > opts = "t"; > eject = 1; > tape = NULL; As Ingo recently reminded me, OpenBSD actually did add getprogname() at some point, which needs need a actually manual forward definition. Joerg
Re: __progname in base
On Sat, Nov 07, 2015 at 03:32:11PM +0100, Joerg Sonnenberger wrote: > As Ingo recently reminded me, OpenBSD actually did add getprogname() at > some point, which needs need a actually manual forward definition. Too early for writing. It does *not* need such an ugly manual extern declaration. Joerg
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
Hi On Sat, Nov 07, 2015 at 04:39:09PM -0500, Michael McConville wrote: > Nicholas Marriott wrote: > > Looks good, ok nicm > > Reviewing now, generally looks good. > > A few things: > > I don't understand the motive for all the err() -> errx() and fatal() -> > fatalx() changes. If I came across these, I probably would have malloc and friends are not guaranteed to set errno (they do on OpenBSD but it is not required). > suggested the reverse. err(1, "xstrdup") is a lot cleaner than a long > custom error message, IMO. I don't know how much value is in showing the > size of the failed allocation, either - thoughts on that? I'm fine with > a little less uniformity for simplicity's sake. I think it is better if they are all the same, and showing the size is useful (for example, if the size is crazy it could be an overflow bug rather than out of memory). > > Also, I'm seeing a couple "could not allocate memory" messages added to > *snprintf() functions. They write to a supplied buffer, no? Yes you are right, it should be a different message. > > We should probably pass the SSH changes by open...@openssh.com. > > This is valuable work - thanks. > > > On Thu, Nov 05, 2015 at 05:35:22PM +0100, Tobias Stoeckmann wrote: > > > On Thu, Nov 05, 2015 at 03:57:26PM +, Nicholas Marriott wrote: > > > > I like this a lot. > > > > > > > > There are some trivial differences in the various xmalloc.h as well, and > > > > I think you could make the style consistent within the files (eg "return > > > > i" in xasprintf and xsnprintf). > > > > > > Oh yes, forgot to check the header files. Updated diff below, including > > > the return (i) vs. return i change. > > > > > > Index: usr.bin/cvs/xmalloc.c > > > === > > > RCS file: /cvs/src/usr.bin/cvs/xmalloc.c,v > > > retrieving revision 1.12 > > > diff -u -p -u -p -r1.12 xmalloc.c > > > --- usr.bin/cvs/xmalloc.c 5 Nov 2015 09:48:21 - 1.12 > > > +++ usr.bin/cvs/xmalloc.c 5 Nov 2015 16:32:21 - > > > @@ -13,6 +13,7 @@ > > > * called by a name other than "ssh" or "Secure Shell". > > > */ > > > > > > +#include > > > #include > > > #include > > > #include > > > @@ -30,7 +31,7 @@ xmalloc(size_t size) > > > fatal("xmalloc: zero size"); > > > ptr = malloc(size); > > > if (ptr == NULL) > > > - fatal("xmalloc: out of memory (allocating %lu bytes)", (u_long) > > > size); > > > + fatal("xmalloc: out of memory (allocating %zu bytes)", size); > > > return ptr; > > > } > > > > > > @@ -41,12 +42,10 @@ xcalloc(size_t nmemb, size_t size) > > > > > > if (size == 0 || nmemb == 0) > > > fatal("xcalloc: zero size"); > > > - if (SIZE_MAX / nmemb < size) > > > - fatal("xcalloc: nmemb * size > SIZE_MAX"); > > > ptr = calloc(nmemb, size); > > > if (ptr == NULL) > > > - fatal("xcalloc: out of memory (allocating %lu bytes)", > > > - (u_long)(size * nmemb)); > > > + fatal("xcalloc: out of memory (allocating %zu * %zu bytes)", > > > + nmemb, size); > > > return ptr; > > > } > > > > > > @@ -54,28 +53,23 @@ void * > > > xreallocarray(void *ptr, size_t nmemb, size_t size) > > > { > > > void *new_ptr; > > > - size_t new_size = nmemb * size; > > > > > > - if (new_size == 0) > > > - fatal("xrealloc: zero size"); > > > - if (SIZE_MAX / nmemb < size) > > > - fatal("xrealloc: nmemb * size > SIZE_MAX"); > > > - new_ptr = realloc(ptr, new_size); > > > + if (nmemb == 0 || size == 0) > > > + fatal("xreallocarray: zero size"); > > > + new_ptr = reallocarray(ptr, nmemb, size); > > > if (new_ptr == NULL) > > > - fatal("xrealloc: out of memory (new_size %lu bytes)", > > > - (u_long) new_size); > > > + fatal("xreallocarray: out of memory " > > > + "(allocating %zu * %zu bytes)", nmemb, size); > > > return new_ptr; > > > } > > > > > > char * > > > xstrdup(const char *str) > > > { > > > - size_t len; > > > char *cp; > > > > > > - len = strlen(str) + 1; > > > - cp = xmalloc(len); > > > - strlcpy(cp, str, len); > > > + if ((cp = strdup(str)) == NULL) > > > + fatal("xstrdup: could not allocate memory"); > > > return cp; > > > } > > > > > > @@ -92,21 +86,24 @@ xasprintf(char **ret, const char *fmt, . > > > if (i < 0 || *ret == NULL) > > > fatal("xasprintf: could not allocate memory"); > > > > > > - return (i); > > > + return i; > > > } > > > > > > int > > > -xsnprintf(char *str, size_t size, const char *fmt, ...) > > > +xsnprintf(char *str, size_t len, const char *fmt, ...) > > > { > > > va_list ap; > > > int i; > > > > > > + if (len > INT_MAX) > > > + fatal("xsnprintf: len > INT_MAX"); > > > + > > > va_start(ap, fmt); > > > - i = vsnprintf(str, size, fmt, ap); > > > + i = vsnprintf(str, len, fmt, ap); > > > va_end(ap); > > > > > > - if (i == -1 || i >= (int)size) > > > -
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
Nicholas Marriott wrote: > Looks good, ok nicm Reviewing now, generally looks good. A few things: I don't understand the motive for all the err() -> errx() and fatal() -> fatalx() changes. If I came across these, I probably would have suggested the reverse. err(1, "xstrdup") is a lot cleaner than a long custom error message, IMO. I don't know how much value is in showing the size of the failed allocation, either - thoughts on that? I'm fine with a little less uniformity for simplicity's sake. Also, I'm seeing a couple "could not allocate memory" messages added to *snprintf() functions. They write to a supplied buffer, no? We should probably pass the SSH changes by open...@openssh.com. This is valuable work - thanks. > On Thu, Nov 05, 2015 at 05:35:22PM +0100, Tobias Stoeckmann wrote: > > On Thu, Nov 05, 2015 at 03:57:26PM +, Nicholas Marriott wrote: > > > I like this a lot. > > > > > > There are some trivial differences in the various xmalloc.h as well, and > > > I think you could make the style consistent within the files (eg "return > > > i" in xasprintf and xsnprintf). > > > > Oh yes, forgot to check the header files. Updated diff below, including > > the return (i) vs. return i change. > > > > Index: usr.bin/cvs/xmalloc.c > > === > > RCS file: /cvs/src/usr.bin/cvs/xmalloc.c,v > > retrieving revision 1.12 > > diff -u -p -u -p -r1.12 xmalloc.c > > --- usr.bin/cvs/xmalloc.c 5 Nov 2015 09:48:21 - 1.12 > > +++ usr.bin/cvs/xmalloc.c 5 Nov 2015 16:32:21 - > > @@ -13,6 +13,7 @@ > > * called by a name other than "ssh" or "Secure Shell". > > */ > > > > +#include > > #include > > #include > > #include > > @@ -30,7 +31,7 @@ xmalloc(size_t size) > > fatal("xmalloc: zero size"); > > ptr = malloc(size); > > if (ptr == NULL) > > - fatal("xmalloc: out of memory (allocating %lu bytes)", (u_long) > > size); > > + fatal("xmalloc: out of memory (allocating %zu bytes)", size); > > return ptr; > > } > > > > @@ -41,12 +42,10 @@ xcalloc(size_t nmemb, size_t size) > > > > if (size == 0 || nmemb == 0) > > fatal("xcalloc: zero size"); > > - if (SIZE_MAX / nmemb < size) > > - fatal("xcalloc: nmemb * size > SIZE_MAX"); > > ptr = calloc(nmemb, size); > > if (ptr == NULL) > > - fatal("xcalloc: out of memory (allocating %lu bytes)", > > - (u_long)(size * nmemb)); > > + fatal("xcalloc: out of memory (allocating %zu * %zu bytes)", > > + nmemb, size); > > return ptr; > > } > > > > @@ -54,28 +53,23 @@ void * > > xreallocarray(void *ptr, size_t nmemb, size_t size) > > { > > void *new_ptr; > > - size_t new_size = nmemb * size; > > > > - if (new_size == 0) > > - fatal("xrealloc: zero size"); > > - if (SIZE_MAX / nmemb < size) > > - fatal("xrealloc: nmemb * size > SIZE_MAX"); > > - new_ptr = realloc(ptr, new_size); > > + if (nmemb == 0 || size == 0) > > + fatal("xreallocarray: zero size"); > > + new_ptr = reallocarray(ptr, nmemb, size); > > if (new_ptr == NULL) > > - fatal("xrealloc: out of memory (new_size %lu bytes)", > > - (u_long) new_size); > > + fatal("xreallocarray: out of memory " > > + "(allocating %zu * %zu bytes)", nmemb, size); > > return new_ptr; > > } > > > > char * > > xstrdup(const char *str) > > { > > - size_t len; > > char *cp; > > > > - len = strlen(str) + 1; > > - cp = xmalloc(len); > > - strlcpy(cp, str, len); > > + if ((cp = strdup(str)) == NULL) > > + fatal("xstrdup: could not allocate memory"); > > return cp; > > } > > > > @@ -92,21 +86,24 @@ xasprintf(char **ret, const char *fmt, . > > if (i < 0 || *ret == NULL) > > fatal("xasprintf: could not allocate memory"); > > > > - return (i); > > + return i; > > } > > > > int > > -xsnprintf(char *str, size_t size, const char *fmt, ...) > > +xsnprintf(char *str, size_t len, const char *fmt, ...) > > { > > va_list ap; > > int i; > > > > + if (len > INT_MAX) > > + fatal("xsnprintf: len > INT_MAX"); > > + > > va_start(ap, fmt); > > - i = vsnprintf(str, size, fmt, ap); > > + i = vsnprintf(str, len, fmt, ap); > > va_end(ap); > > > > - if (i == -1 || i >= (int)size) > > - fatal("xsnprintf: overflow"); > > + if (i < 0 || i >= (int)len) > > + fatal("xsnprintf: could not allocate memory"); > > > > - return (i); > > + return i; > > } > > Index: usr.bin/diff/xmalloc.c > > === > > RCS file: /cvs/src/usr.bin/diff/xmalloc.c,v > > retrieving revision 1.8 > > diff -u -p -u -p -r1.8 xmalloc.c > > --- usr.bin/diff/xmalloc.c 25 Sep 2015 16:16:26 - 1.8 > > +++ usr.bin/diff/xmalloc.c 5 Nov 2015 16:32:21 - > > @@ -27,9 +27,11 @@
Re: remove IF_PREPEND in src/sys/dev/pci, was Re: IFQ_PREPEND
> On 6 Nov 2015, at 9:35 PM, David Gwynnewrote: > > On Wed, Nov 04, 2015 at 08:18:48AM +0100, Martin Pieuchot wrote: >> On 04/11/15(Wed) 10:39, David Gwynne wrote: >>> im working on making the interface send queue mpsafe. >>> >>> part of that involced deprecating the IFQ_POLL api because it allows the >>> caller to get a reference an mbuf that is still on the send queue. this is >>> dangerous if another cpu tries to manipulate the send queue. instead code >>> should call IFQ_DEQUEUE, which takes it off the queue for the driver to use. >>> >>> however, blindly changing code from IFQ_POLL to IFQ_DEQUEUE will >>> cause unwanted packet loss when encapsulation fails in some cases, >>> such as when the tx ring is already full. to cope, the easiest >>> solution is to requeue the packet so the next call to the start >>> routine can try fitting it on the ring again. >>> >>> this introduces IFQ_PREPEND (cause we currently have IF_PREPEND) >>> and works on top of both hfsc and priq because i added hfsc_requeue >>> a while back. >>> >>> this also converts uses of IF_PREPEND in drivers to IFQ_PREPEND. >>> this improves the situation a bit if people have decided to use >>> hfsc on these interfaces. > > ok, so after talking to kenjiro cho about the problems with IFQ_PREPEND > and arbitrary queuing disciplines, im taking a step back while > thinking about how to approach the send queue stuff for a bit. > however, deprecating IF_PREPEND is still necessary. > > this tweaks the relevant drivers to not need IF_PREPEND. note that > these are non-trivial changes, so i would like some review and maybe > some actual testing? especially on vr, im sure there are a lot of > users. > > most of the changes are just shuffling conditionals around, but vr > also includes a change to use m_defrag. im not sure that is enough > to satisfy the alignment requirements the code discusses, so testing > is necessary. and at least one of age, alc, or ale. noone has a vr? > > ok? > > Index: if_age.c > === > RCS file: /cvs/src/sys/dev/pci/if_age.c,v > retrieving revision 1.29 > diff -u -p -r1.29 if_age.c > --- if_age.c 25 Oct 2015 13:04:28 - 1.29 > +++ if_age.c 6 Nov 2015 11:27:04 - > @@ -89,7 +89,7 @@ voidage_dma_free(struct age_softc *); > void age_get_macaddr(struct age_softc *); > void age_phy_reset(struct age_softc *); > > -int age_encap(struct age_softc *, struct mbuf **); > +int age_encap(struct age_softc *, struct mbuf *); > void age_init_tx_ring(struct age_softc *); > int age_init_rx_ring(struct age_softc *); > void age_init_rr_ring(struct age_softc *); > @@ -957,7 +957,7 @@ void > age_start(struct ifnet *ifp) > { > struct age_softc *sc = ifp->if_softc; > -struct mbuf *m_head; > +struct mbuf *m; > int enq; > > if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) > @@ -969,8 +969,14 @@ age_start(struct ifnet *ifp) > > enq = 0; > for (;;) { > - IFQ_DEQUEUE(>if_snd, m_head); > - if (m_head == NULL) > + if (sc->age_cdata.age_tx_cnt + AGE_MAXTXSEGS >= > + AGE_TX_RING_CNT - 2) { > + ifp->if_flags |= IFF_OACTIVE; > + break; > + } > + > + IFQ_DEQUEUE(>if_snd, m); > + if (m == NULL) > break; > > /* > @@ -978,14 +984,9 @@ age_start(struct ifnet *ifp) >* don't have room, set the OACTIVE flag and wait >* for the NIC to drain the ring. >*/ > - if (age_encap(sc, _head)) { > - if (m_head == NULL) > - ifp->if_oerrors++; > - else { > - IF_PREPEND(>if_snd, m_head); > - ifp->if_flags |= IFF_OACTIVE; > - } > - break; > + if (age_encap(sc, m) != 0) { > + ifp->if_oerrors++; > + continue; > } > enq = 1; > > @@ -995,7 +996,7 @@ age_start(struct ifnet *ifp) >* to him. >*/ > if (ifp->if_bpf != NULL) > - bpf_mtap_ether(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); > + bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_OUT); > #endif > } > > @@ -1115,16 +1116,14 @@ age_mac_config(struct age_softc *sc) > } > > int > -age_encap(struct age_softc *sc, struct mbuf **m_head) > +age_encap(struct age_softc *sc, struct mbuf *m) > { > struct age_txdesc *txd, *txd_last; > struct tx_desc *desc; > - struct mbuf *m; > bus_dmamap_t map; > uint32_t cflags, poff, vtag; > int error, i, prod; > > - m = *m_head; > cflags = vtag = 0; > poff = 0; > > @@ -1133,27 +1132,20 @@ age_encap(struct age_softc
Re: patch saves some cycles by extending pfr_walktree() a bit
On Wed, Oct 28, 2015 at 06:08:00PM +0100, Alexandr Nedvedicky wrote: > make implementation of reference handling and further MP stuff bit easier. I agree that filling the temporary list makes transition to MP harder. > Also the patch is part of my effort to kill work queues in radix tables. For now the code gets more as we have two ways to iterate over the tree. When you remove the additional work queues I expect many - diffs. So if this code dupliation is temporary, this aproach is fine for me. > #define pfrw_addrpfrw_1.pfrw1_addr > #define pfrw_astats pfrw_1.pfrw1_astats > #define pfrw_workq pfrw_1.pfrw1_workq > #define pfrw_kentry pfrw_1.pfrw1_kentry > #define pfrw_dyn pfrw_1.pfrw1_dyn > +#define pfrw_tzero pfrw_1.pfrw1_clstat.tzero > +#define pfrw_negchange pfrw_1.pfrw1_clstat.negchange > #define pfrw_cnt pfrw_free Use space instead of tab after the define. Otherwise it is incosistent and the diff looks ugly. OK bluhm@
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
Here's an updated diff: - use "overflow" error message for snprintf and friends - use err instead of errx for out of memory conditions - if fatal() doesn't print error string, use ": %s", strerror(errno) Is this okay for ssh and tmux, which are out to be very portable? Nicholas mentioned that malloc is not required to set errno. I've also checked the standard and it's just an extension. Although at worst, the user sees a wrong error message... Index: usr.bin/cvs/xmalloc.c === RCS file: /cvs/src/usr.bin/cvs/xmalloc.c,v retrieving revision 1.12 diff -u -p -u -p -r1.12 xmalloc.c --- usr.bin/cvs/xmalloc.c 5 Nov 2015 09:48:21 - 1.12 +++ usr.bin/cvs/xmalloc.c 8 Nov 2015 00:27:13 - @@ -13,6 +13,8 @@ * called by a name other than "ssh" or "Secure Shell". */ +#include +#include #include #include #include @@ -30,7 +32,8 @@ xmalloc(size_t size) fatal("xmalloc: zero size"); ptr = malloc(size); if (ptr == NULL) - fatal("xmalloc: out of memory (allocating %lu bytes)", (u_long) size); + fatal("xmalloc: allocating %zu bytes: %s", + size, strerror(errno)); return ptr; } @@ -41,12 +44,10 @@ xcalloc(size_t nmemb, size_t size) if (size == 0 || nmemb == 0) fatal("xcalloc: zero size"); - if (SIZE_MAX / nmemb < size) - fatal("xcalloc: nmemb * size > SIZE_MAX"); ptr = calloc(nmemb, size); if (ptr == NULL) - fatal("xcalloc: out of memory (allocating %lu bytes)", - (u_long)(size * nmemb)); + fatal("xcalloc: allocating %zu * %zu bytes: %s", + nmemb, size, strerror(errno)); return ptr; } @@ -54,28 +55,23 @@ void * xreallocarray(void *ptr, size_t nmemb, size_t size) { void *new_ptr; - size_t new_size = nmemb * size; - if (new_size == 0) - fatal("xrealloc: zero size"); - if (SIZE_MAX / nmemb < size) - fatal("xrealloc: nmemb * size > SIZE_MAX"); - new_ptr = realloc(ptr, new_size); + if (nmemb == 0 || size == 0) + fatal("xreallocarray: zero size"); + new_ptr = reallocarray(ptr, nmemb, size); if (new_ptr == NULL) - fatal("xrealloc: out of memory (new_size %lu bytes)", - (u_long) new_size); + fatal("xreallocarray: allocating %zu * %zu bytes: %s", + nmemb, size, strerror(errno)); return new_ptr; } char * xstrdup(const char *str) { - size_t len; char *cp; - len = strlen(str) + 1; - cp = xmalloc(len); - strlcpy(cp, str, len); + if ((cp = strdup(str)) == NULL) + fatal("xstrdup: %s", strerror(errno)); return cp; } @@ -90,23 +86,26 @@ xasprintf(char **ret, const char *fmt, . va_end(ap); if (i < 0 || *ret == NULL) - fatal("xasprintf: could not allocate memory"); + fatal("xasprintf: %s", strerror(errno)); - return (i); + return i; } int -xsnprintf(char *str, size_t size, const char *fmt, ...) +xsnprintf(char *str, size_t len, const char *fmt, ...) { va_list ap; int i; + if (len > INT_MAX) + fatal("xsnprintf: len > INT_MAX"); + va_start(ap, fmt); - i = vsnprintf(str, size, fmt, ap); + i = vsnprintf(str, len, fmt, ap); va_end(ap); - if (i == -1 || i >= (int)size) + if (i < 0 || i >= (int)len) fatal("xsnprintf: overflow"); - return (i); + return i; } Index: usr.bin/diff/xmalloc.c === RCS file: /cvs/src/usr.bin/diff/xmalloc.c,v retrieving revision 1.8 diff -u -p -u -p -r1.8 xmalloc.c --- usr.bin/diff/xmalloc.c 25 Sep 2015 16:16:26 - 1.8 +++ usr.bin/diff/xmalloc.c 8 Nov 2015 00:27:13 - @@ -27,9 +27,11 @@ xmalloc(size_t size) { void *ptr; + if (size == 0) + errx(2, "xmalloc: zero size"); ptr = malloc(size); if (ptr == NULL) - err(2, "xmalloc %zu", size); + err(2, "xmalloc: allocating %zu bytes", size); return ptr; } @@ -40,8 +42,7 @@ xcalloc(size_t nmemb, size_t size) ptr = calloc(nmemb, size); if (ptr == NULL) - err(2, "xcalloc: out of memory (allocating %zu*%zu bytes)", - nmemb, size); + err(2, "xcalloc: allocating %zu * %zu bytes", nmemb, size); return ptr; } @@ -52,7 +53,8 @@ xreallocarray(void *ptr, size_t nmemb, s new_ptr = reallocarray(ptr, nmemb, size); if (new_ptr == NULL) - err(2, "xrealloc %zu*%zu", nmemb, size); + err(2, "xreallocarray: allocating %zu * %zu bytes", + nmemb, size); return
Re: Patch 2/3 - make DIOCRDELADDRS to accept on IP address per ioctl() call
On Wed, Oct 28, 2015 at 06:21:10PM +0100, Alexandr Nedvedicky wrote: > Index: sbin/pfctl/pfctl_radix.c > === > RCS file: /cvs/src/sbin/pfctl/pfctl_radix.c,v > retrieving revision 1.32 > diff -u -p -r1.32 pfctl_radix.c > --- sbin/pfctl/pfctl_radix.c 21 Jan 2015 21:50:33 - 1.32 > +++ sbin/pfctl/pfctl_radix.c 27 Oct 2015 22:56:54 - > @@ -207,6 +207,7 @@ pfr_del_addrs(struct pfr_table *tbl, str > int *ndel, int flags) > { > struct pfioc_table io; > + int i, rv, del = 0; > > if (tbl == NULL || size < 0 || (size && addr == NULL)) { > errno = EINVAL; > @@ -215,14 +216,18 @@ pfr_del_addrs(struct pfr_table *tbl, str > bzero(, sizeof io); > io.pfrio_flags = flags; > io.pfrio_table = *tbl; > - io.pfrio_buffer = addr; > io.pfrio_esize = sizeof(*addr); > - io.pfrio_size = size; > - if (ioctl(dev, DIOCRDELADDRS, )) > - return (-1); > - if (ndel != NULL) > - *ndel = io.pfrio_ndel; > - return (0); > + io.pfrio_size = 1; > + for (i = 0; (i < size) && (rv == 0); i++) { rv may be unitialized > + io.pfrio_buffer = addr++; > + rv = ioctl(dev, DIOCRDELADDR, ); > + del++; > + } > + > + if ((rv == 0) && (ndel != NULL)) > + *ndel = del; > + > + return (rv); > } > > int > Index: sys/net/pf_ioctl.c > === > RCS file: /cvs/src/sys/net/pf_ioctl.c,v > retrieving revision 1.291 > diff -u -p -r1.291 pf_ioctl.c > --- sys/net/pf_ioctl.c13 Oct 2015 19:32:31 - 1.291 > +++ sys/net/pf_ioctl.c27 Oct 2015 22:57:20 - > @@ -835,7 +835,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a > case DIOCRCLRTSTATS: > case DIOCRCLRADDRS: > case DIOCRADDADDRS: > - case DIOCRDELADDRS: > + case DIOCRDELADDR: > case DIOCRSETADDRS: > case DIOCRGETASTATS: > case DIOCRCLRASTATS: > @@ -888,7 +888,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a > case DIOCRCLRTSTATS: > case DIOCRCLRADDRS: > case DIOCRADDADDRS: > - case DIOCRDELADDRS: > + case DIOCRDELADDR: > case DIOCRSETADDRS: > case DIOCRSETTFLAGS: > if (((struct pfioc_table *)addr)->pfrio_flags & > @@ -1829,16 +1829,15 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a > break; > } > > - case DIOCRDELADDRS: { > + case DIOCRDELADDR: { > struct pfioc_table *io = (struct pfioc_table *)addr; > > if (io->pfrio_esize != sizeof(struct pfr_addr)) { > error = ENODEV; > break; > } > - error = pfr_del_addrs(>pfrio_table, io->pfrio_buffer, > - io->pfrio_size, >pfrio_ndel, io->pfrio_flags | > - PFR_FLAG_USERIOCTL); > + error = pfr_del_addr(>pfrio_table, io->pfrio_buffer, > + io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); Don't pass io->pfrio_size. > break; > } > > Index: sys/net/pf_table.c > === > RCS file: /cvs/src/sys/net/pf_table.c,v > retrieving revision 1.115 > diff -u -p -r1.115 pf_table.c > --- sys/net/pf_table.c7 Oct 2015 11:57:44 - 1.115 > +++ sys/net/pf_table.c27 Oct 2015 22:57:24 - > @@ -152,6 +152,8 @@ void pfr_destroy_kentries(struct > pfr_ > void pfr_destroy_kentry(struct pfr_kentry *); > void pfr_insert_kentries(struct pfr_ktable *, > struct pfr_kentryworkq *, time_t); > +void pfr_remove_kentry(struct pfr_ktable *, > + struct pfr_kentry *); > void pfr_remove_kentries(struct pfr_ktable *, > struct pfr_kentryworkq *); > void pfr_clstats_kentries(struct pfr_kentryworkq *, time_t, > @@ -343,14 +345,12 @@ _bad: > } > > int > -pfr_del_addrs(struct pfr_table *tbl, struct pfr_addr *addr, int size, > -int *ndel, int flags) > +pfr_del_addr(struct pfr_table *tbl, struct pfr_addr *addr, int size, int > flags) Don't pass size. > { > struct pfr_ktable *kt; > - struct pfr_kentryworkq workq; > struct pfr_kentry *p; > struct pfr_addr ad; > - int i, rv, xdel = 0, log = 1; > + int rv; > > ACCEPT_FLAGS(flags, PFR_FLAG_DUMMY | PFR_FLAG_FEEDBACK); > if (pfr_validate_table(tbl, 0, flags & PFR_FLAG_USERIOCTL)) > @@ -360,70 +360,29 @@ pfr_del_addrs(struct pfr_table *tbl, str > return (ESRCH); > if (kt->pfrkt_flags & PFR_TFLAG_CONST) >
Re: remove IF_PREPEND in src/sys/dev/pci, was Re: IFQ_PREPEND
> noone has a vr? You can't expect people to use the crappiest Ethernet chip ever designed.
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
Michael McConville wrote: > Nicholas Marriott wrote: > > Looks good, ok nicm > > Reviewing now, generally looks good. > > A few things: > > I don't understand the motive for all the err() -> errx() and fatal() -> > fatalx() changes. If I came across these, I probably would have > suggested the reverse. err(1, "xstrdup") is a lot cleaner than a long > custom error message, IMO. I don't know how much value is in showing the > size of the failed allocation, either - thoughts on that? I'm fine with > a little less uniformity for simplicity's sake. Showing the size lets you determine if something has gone terribly wrong (can't allocate 3840284093284092840928402 bytes) versus a more mundane out of memory condition. Allocation failure is usually the final symptom of some other disease. But agreed that always printing "out of memory" seems like a step backwards from printing what errno tells us. It's discarding information. > Also, I'm seeing a couple "could not allocate memory" messages added to > *snprintf() functions. They write to a supplied buffer, no? Good catch. > > > + i = vsnprintf(str, len, fmt, ap); > > > va_end(ap); > > > > > > - if (i == -1 || i >= (int)size) > > > - fatal("xsnprintf: overflow"); > > > + if (i < 0 || i >= (int)len) > > > + fatal("xsnprintf: could not allocate memory"); This change (among a few others) is wrong.
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
On Sat, Nov 07, 2015 at 05:57:55PM -0500, Ted Unangst wrote: > > Also, I'm seeing a couple "could not allocate memory" messages added to > > *snprintf() functions. They write to a supplied buffer, no? > > Good catch. Will update that one, thanks. > > > > + i = vsnprintf(str, len, fmt, ap); > > > > va_end(ap); > > > > > > > > - if (i == -1 || i >= (int)size) > > > > - fatal("xsnprintf: overflow"); > > > > + if (i < 0 || i >= (int)len) > > > > + fatal("xsnprintf: could not allocate memory"); > > This change (among a few others) is wrong. Could you give me a bit of detail what's wrong here? Can update the diff when you give me details on "a few others", too.
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
Tobias Stoeckmann wrote: > > > > > + i = vsnprintf(str, len, fmt, ap); > > > > > va_end(ap); > > > > > > > > > > - if (i == -1 || i >= (int)size) > > > > > - fatal("xsnprintf: overflow"); > > > > > + if (i < 0 || i >= (int)len) > > > > > + fatal("xsnprintf: could not allocate memory"); > > > > This change (among a few others) is wrong. > > Could you give me a bit of detail what's wrong here? > Can update the diff when you give me details on "a few others", too. Anything that doesn't allocate memory can't fail to allocate memory. This would be the sprintf variants that are not asprintf.
Re: remove IF_PREPEND in src/sys/dev/pci, was Re: IFQ_PREPEND
> On 8 Nov 2015, at 8:23 AM, Miod Vallatwrote: > >> noone has a vr? > > You can't expect people to use the crappiest Ethernet chip ever > designed. theyre in the alix, surely someone has those still. i thought le(4) was the worst.
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
Tobias Stoeckmann wrote: > Is this okay for ssh and tmux, which are out to be very portable? > Nicholas mentioned that malloc is not required to set errno. I've also > checked the standard and it's just an extension. Although at worst, > the user sees a wrong error message... Are they portable to not-posix? posix dictates that malloc set errno.
Re: Patch 1/3 - make DIOCRADDADDRS to accept on IP address per ioctl() call
On Wed, Oct 28, 2015 at 06:19:48PM +0100, Alexandr Nedvedicky wrote: > The idea has been proposed by Claudio at Varazdin. I guess the idea is to eliminate the workq. Or is ther naother reason to change it? Comments inline > Index: sbin/pfctl/pfctl_radix.c > === > RCS file: /cvs/src/sbin/pfctl/pfctl_radix.c,v > retrieving revision 1.32 > diff -u -p -r1.32 pfctl_radix.c > --- sbin/pfctl/pfctl_radix.c 21 Jan 2015 21:50:33 - 1.32 > +++ sbin/pfctl/pfctl_radix.c 27 Oct 2015 23:24:59 - > @@ -184,6 +184,7 @@ pfr_add_addrs(struct pfr_table *tbl, str > int *nadd, int flags) > { > struct pfioc_table io; > + int i, rv, add = 0; > > if (tbl == NULL || size < 0 || (size && addr == NULL)) { > errno = EINVAL; > @@ -192,14 +193,18 @@ pfr_add_addrs(struct pfr_table *tbl, str > bzero(, sizeof io); > io.pfrio_flags = flags; > io.pfrio_table = *tbl; > - io.pfrio_buffer = addr; > io.pfrio_esize = sizeof(*addr); > - io.pfrio_size = size; > - if (ioctl(dev, DIOCRADDADDRS, )) > - return (-1); > - if (nadd != NULL) > - *nadd = io.pfrio_nadd; > - return (0); > + io.pfrio_size = 1; /* TODO: check .pfrio_size is needed */ > + for (i = 0; (i < size) && (rv == 0); i++) { rv is unitialized in the first interation > + io.pfrio_buffer = addr++; > + rv = ioctl(dev, DIOCRADDADDR, ); I would suggest to return (-1) if ioctl fails... > + add++; > + } > + > + if ((rv == 0) && (nadd != NULL)) > + *nadd = add; > + > + return (rv); ... then you can return (0) here and don't need the rv variable. > } > > int > Index: sys/net/pf_ioctl.c > === > RCS file: /cvs/src/sys/net/pf_ioctl.c,v > retrieving revision 1.291 > diff -u -p -r1.291 pf_ioctl.c > --- sys/net/pf_ioctl.c13 Oct 2015 19:32:31 - 1.291 > +++ sys/net/pf_ioctl.c27 Oct 2015 23:25:23 - > @@ -834,7 +834,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a > case DIOCRGETTSTATS: > case DIOCRCLRTSTATS: > case DIOCRCLRADDRS: > - case DIOCRADDADDRS: > + case DIOCRADDADDR: > case DIOCRDELADDRS: > case DIOCRSETADDRS: > case DIOCRGETASTATS: > @@ -887,7 +887,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a > case DIOCRDELTABLES: > case DIOCRCLRTSTATS: > case DIOCRCLRADDRS: > - case DIOCRADDADDRS: > + case DIOCRADDADDR: > case DIOCRDELADDRS: > case DIOCRSETADDRS: > case DIOCRSETTFLAGS: > @@ -1816,16 +1816,15 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a > break; > } > > - case DIOCRADDADDRS: { > + case DIOCRADDADDR: { > struct pfioc_table *io = (struct pfioc_table *)addr; > > if (io->pfrio_esize != sizeof(struct pfr_addr)) { > error = ENODEV; > break; > } > - error = pfr_add_addrs(>pfrio_table, io->pfrio_buffer, > - io->pfrio_size, >pfrio_nadd, io->pfrio_flags | > - PFR_FLAG_USERIOCTL); > + error = pfr_add_addr(>pfrio_table, io->pfrio_buffer, > + io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); pfr_add_addr() handles exactly 1 address, don't pass io->pfrio_size. > break; > } > > Index: sys/net/pf_table.c > === > RCS file: /cvs/src/sys/net/pf_table.c,v > retrieving revision 1.115 > diff -u -p -r1.115 pf_table.c > --- sys/net/pf_table.c7 Oct 2015 11:57:44 - 1.115 > +++ sys/net/pf_table.c27 Oct 2015 23:25:26 - > @@ -266,6 +266,54 @@ pfr_clr_addrs(struct pfr_table *tbl, int > } > > int > +pfr_add_addr(struct pfr_table *tbl, struct pfr_addr *addr, int size, int > flags) Do not pass size. > +{ > + struct pfr_ktable *kt; > + struct pfr_kentry *p; > + struct pfr_addr ad; > + int rv; > + time_t tzero = time_second; > + > + ACCEPT_FLAGS(flags, PFR_FLAG_DUMMY | PFR_FLAG_FEEDBACK); > + if (pfr_validate_table(tbl, 0, flags & PFR_FLAG_USERIOCTL)) > + return (EINVAL); > + kt = pfr_lookup_table(tbl); > + if (kt == NULL || !(kt->pfrkt_flags & PFR_TFLAG_ACTIVE)) > + return (ESRCH); > + if (kt->pfrkt_flags & PFR_TFLAG_CONST) > + return (EPERM); > + if (COPYIN(addr, , sizeof(ad), flags)) > + senderr(EFAULT); > + if (pfr_validate_addr()) > + senderr(EINVAL); > + p = pfr_lookup_addr(kt, , 1); > + if (p == NULL) { Should you check for !(flags & PFR_FLAG_DUMMY) here? It was
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
On Thu, Nov 05, 2015 at 03:50:29PM +0100, Tobias Stoeckmann wrote: > On Thu, Nov 05, 2015 at 09:50:48AM +, Nicholas Marriott wrote: > > I don't know why cvs and rcs xmalloc.c has ended up so different. > > It's not just about cvs and rcs: > > /usr/src/usr.bin/cvs/xmalloc.c > /usr/src/usr.bin/diff/xmalloc.c > /usr/src/usr.bin/file/xmalloc.c > /usr/src/usr.bin/rcs/xmalloc.c > /usr/src/usr.bin/ssh/xmalloc.c > /usr/src/usr.bin/tmux/xmalloc.c (probably not same origin) > Also note that aucat(1)'s utils.c contains xmalloc() and xfree(). Its version of xfree() contains no special logic so remove it? Index: abuf.c === RCS file: /cvs/src/usr.bin/aucat/abuf.c,v retrieving revision 1.26 diff -u -p -u -r1.26 abuf.c --- abuf.c 21 Jan 2015 08:43:55 - 1.26 +++ abuf.c 8 Nov 2015 02:16:41 - @@ -62,7 +62,7 @@ abuf_done(struct abuf *buf) } } #endif - xfree(buf->data); + free(buf->data); buf->data = (void *)0xdeadbeef; } Index: aucat.c === RCS file: /cvs/src/usr.bin/aucat/aucat.c,v retrieving revision 1.149 diff -u -p -u -r1.149 aucat.c --- aucat.c 27 Aug 2015 07:25:56 - 1.149 +++ aucat.c 8 Nov 2015 02:16:42 - @@ -214,7 +214,7 @@ slot_new(char *path, int mode, struct ap if (!afile_open(>afile, path, hdr, mode == SIO_PLAY ? AFILE_FREAD : AFILE_FWRITE, par, rate, cmax - cmin + 1)) { - xfree(s); + free(s); return 0; } s->cmin = cmin; @@ -413,15 +413,13 @@ slot_del(struct slot *s) } #endif abuf_done(>buf); - if (s->resampbuf) - xfree(s->resampbuf); - if (s->convbuf) - xfree(s->convbuf); + free(s->resampbuf); + free(s->convbuf); } for (ps = _list; *ps != s; ps = &(*ps)->next) ; /* nothing */ *ps = s->next; - xfree(s); + free(s); } static int @@ -672,9 +670,9 @@ dev_close(void) if (dev_mh) mio_close(dev_mh); if (dev_mode & SIO_PLAY) - xfree(dev_pbuf); + free(dev_pbuf); if (dev_mode & SIO_REC) - xfree(dev_rbuf); + free(dev_rbuf); } static void @@ -999,7 +997,7 @@ offline(void) slot_list_copy(todo, dev_pchan, dev_pbuf); slot_list_iodo(); } - xfree(dev_pbuf); + free(dev_pbuf); while (slot_list) slot_del(slot_list); return 1; @@ -1148,7 +1146,7 @@ playrec(char *dev, int mode, int bufsz, if (dev_pstate == DEV_START) dev_mmcstop(); - xfree(pfds); + free(pfds); dev_close(); while (slot_list) slot_del(slot_list); Index: utils.c === RCS file: /cvs/src/usr.bin/aucat/utils.c,v retrieving revision 1.1 diff -u -p -u -r1.1 utils.c --- utils.c 21 Jan 2015 08:43:55 - 1.1 +++ utils.c 8 Nov 2015 02:16:42 - @@ -158,15 +158,6 @@ xmalloc(size_t size) } /* - * free memory allocated with xmalloc() - */ -void -xfree(void *p) -{ - free(p); -} - -/* * xmalloc-style strdup(3) */ char * Index: utils.h === RCS file: /cvs/src/usr.bin/aucat/utils.h,v retrieving revision 1.1 diff -u -p -u -r1.1 utils.h --- utils.h 21 Jan 2015 08:43:55 - 1.1 +++ utils.h 8 Nov 2015 02:16:42 - @@ -29,7 +29,6 @@ void log_flush(void); void *xmalloc(size_t); char *xstrdup(char *); -void xfree(void *); /* * Log levels:
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
Michael W. Bombardieri wrote: > On Thu, Nov 05, 2015 at 03:50:29PM +0100, Tobias Stoeckmann wrote: > > On Thu, Nov 05, 2015 at 09:50:48AM +, Nicholas Marriott wrote: > > > I don't know why cvs and rcs xmalloc.c has ended up so different. > > > > It's not just about cvs and rcs: > > > > /usr/src/usr.bin/cvs/xmalloc.c > > /usr/src/usr.bin/diff/xmalloc.c > > /usr/src/usr.bin/file/xmalloc.c > > /usr/src/usr.bin/rcs/xmalloc.c > > /usr/src/usr.bin/ssh/xmalloc.c > > /usr/src/usr.bin/tmux/xmalloc.c (probably not same origin) > > Also note that aucat(1)'s utils.c contains xmalloc() and xfree(). > Its version of xfree() contains no special logic so remove it? ok mmcc@ > Index: abuf.c > === > RCS file: /cvs/src/usr.bin/aucat/abuf.c,v > retrieving revision 1.26 > diff -u -p -u -r1.26 abuf.c > --- abuf.c21 Jan 2015 08:43:55 - 1.26 > +++ abuf.c8 Nov 2015 02:16:41 - > @@ -62,7 +62,7 @@ abuf_done(struct abuf *buf) > } > } > #endif > - xfree(buf->data); > + free(buf->data); > buf->data = (void *)0xdeadbeef; > } > > Index: aucat.c > === > RCS file: /cvs/src/usr.bin/aucat/aucat.c,v > retrieving revision 1.149 > diff -u -p -u -r1.149 aucat.c > --- aucat.c 27 Aug 2015 07:25:56 - 1.149 > +++ aucat.c 8 Nov 2015 02:16:42 - > @@ -214,7 +214,7 @@ slot_new(char *path, int mode, struct ap > if (!afile_open(>afile, path, hdr, > mode == SIO_PLAY ? AFILE_FREAD : AFILE_FWRITE, > par, rate, cmax - cmin + 1)) { > - xfree(s); > + free(s); > return 0; > } > s->cmin = cmin; > @@ -413,15 +413,13 @@ slot_del(struct slot *s) > } > #endif > abuf_done(>buf); > - if (s->resampbuf) > - xfree(s->resampbuf); > - if (s->convbuf) > - xfree(s->convbuf); > + free(s->resampbuf); > + free(s->convbuf); > } > for (ps = _list; *ps != s; ps = &(*ps)->next) > ; /* nothing */ > *ps = s->next; > - xfree(s); > + free(s); > } > > static int > @@ -672,9 +670,9 @@ dev_close(void) > if (dev_mh) > mio_close(dev_mh); > if (dev_mode & SIO_PLAY) > - xfree(dev_pbuf); > + free(dev_pbuf); > if (dev_mode & SIO_REC) > - xfree(dev_rbuf); > + free(dev_rbuf); > } > > static void > @@ -999,7 +997,7 @@ offline(void) > slot_list_copy(todo, dev_pchan, dev_pbuf); > slot_list_iodo(); > } > - xfree(dev_pbuf); > + free(dev_pbuf); > while (slot_list) > slot_del(slot_list); > return 1; > @@ -1148,7 +1146,7 @@ playrec(char *dev, int mode, int bufsz, > > if (dev_pstate == DEV_START) > dev_mmcstop(); > - xfree(pfds); > + free(pfds); > dev_close(); > while (slot_list) > slot_del(slot_list); > Index: utils.c > === > RCS file: /cvs/src/usr.bin/aucat/utils.c,v > retrieving revision 1.1 > diff -u -p -u -r1.1 utils.c > --- utils.c 21 Jan 2015 08:43:55 - 1.1 > +++ utils.c 8 Nov 2015 02:16:42 - > @@ -158,15 +158,6 @@ xmalloc(size_t size) > } > > /* > - * free memory allocated with xmalloc() > - */ > -void > -xfree(void *p) > -{ > - free(p); > -} > - > -/* > * xmalloc-style strdup(3) > */ > char * > Index: utils.h > === > RCS file: /cvs/src/usr.bin/aucat/utils.h,v > retrieving revision 1.1 > diff -u -p -u -r1.1 utils.h > --- utils.h 21 Jan 2015 08:43:55 - 1.1 > +++ utils.h 8 Nov 2015 02:16:42 - > @@ -29,7 +29,6 @@ void log_flush(void); > > void *xmalloc(size_t); > char *xstrdup(char *); > -void xfree(void *); > > /* > * Log levels: >
[PATCH 2/2] flex 2.5.39
This patch includes minor changes to files that wouldn't compile with flex 2.5.39. Index: usr.sbin/config/scan.l === RCS file: /cvs/src/usr.sbin/config/scan.l,v retrieving revision 1.22 diff -u -p -u -r1.22 scan.l --- usr.sbin/config/scan.l 16 Jan 2015 06:40:16 - 1.22 +++ usr.sbin/config/scan.l 7 Nov 2015 05:26:23 - @@ -67,9 +67,9 @@ struct incl { static struct incl *incl; static int endinclude(void); -#defineyywrap() 1 - %} + +%option noyywrap PATH [A-Za-z_0-9]*[./][-A-Za-z_0-9./\$\{\}]* WORD [A-Za-z_][-A-Za-z_0-9]* Index: lib/libkeynote/keynote.l === RCS file: /cvs/src/lib/libkeynote/keynote.l,v retrieving revision 1.21 diff -u -p -u -r1.21 keynote.l --- lib/libkeynote/keynote.l4 Feb 2015 20:35:51 - 1.21 +++ lib/libkeynote/keynote.l7 Nov 2015 05:26:23 - @@ -746,7 +746,6 @@ keynote_get_envlist(char *buf, char *buf if (0) { yyunput(0, NULL); - yy_flex_realloc(0, 0); } return en; Index: lib/libkeynote/keynote-ver.l === RCS file: /cvs/src/lib/libkeynote/keynote-ver.l,v retrieving revision 1.16 diff -u -p -u -r1.16 keynote-ver.l --- lib/libkeynote/keynote-ver.l29 Nov 2013 19:00:51 - 1.16 +++ lib/libkeynote/keynote-ver.l7 Nov 2015 05:26:23 - @@ -252,7 +252,6 @@ read_environment(char *filename) if (0) { yyunput(0, NULL); - yy_flex_realloc(0, 0); } } Index: sbin/wsconsctl/map_scan.l === RCS file: /cvs/src/sbin/wsconsctl/map_scan.l,v retrieving revision 1.5 diff -u -p -u -r1.5 map_scan.l --- sbin/wsconsctl/map_scan.l 18 Apr 2015 18:28:37 - 1.5 +++ sbin/wsconsctl/map_scan.l 7 Nov 2015 05:26:23 - @@ -30,6 +30,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ +%option noyywrap + %{ #include @@ -38,8 +40,6 @@ #include #include "wsconsctl.h" #include "y.tab.h" - -#define yywrap() 1 void map_scan_setinput(char *str)
Re: [patch] armv7/imx/imxesdhc.c: add imxesdhc_dump_regs
On Fri, Nov 06, 2015 at 08:04:43PM -0500, kremlin wrote: > Hello, > > This patch adds a debugging function dumping the contents of all > registers implicated in the armv7/imx specific sd/mmc controller. It > only prints if the kernel is built with option SDHC_DEBUG and a call is > inserted somewhere. > > I am trying to fix the outstanding bug causing the imxesdhc driver to > timeout upon block reads (CMD17) which prevents any meaningful I/O with > "disks" on i.MX6 platforms. If anyone has any helpful pointers to this > end, please respond on-list or to i...@kremlin.cc I tried enabling bits in the ccm, enabling clocks, making various changes to imxesdhc itself and didn't get anywhere. Similiar story with the usb otg port on the cubox. The novena has two slots one internal one with a card detect line and one without. I was told the one without card detect (external) has working io and can be mounted the other one can not.