diff --git a/sys/src/kern/386/uartpci.c b/sys/src/kern/386/uartpci.c index e092a50..6c7e46b 100644 --- a/sys/src/kern/386/uartpci.c +++ b/sys/src/kern/386/uartpci.c @@ -25,7 +25,7 @@ uartpci(int ctlrno, Pcidev* p, int barno, int n, int freq, char* name) return nil; } - head = uart = malloc(sizeof(Uart)*n); + head = uart = mallocz(sizeof(Uart)*n, 1); for(i = 0; i < n; i++){ ctlr = i8250alloc(io, p->intl, p->tbdf); diff --git a/sys/src/kern/boot/boot.h b/sys/src/kern/boot/boot.h index 54aa7c4..cc58884 100644 --- a/sys/src/kern/boot/boot.h +++ b/sys/src/kern/boot/boot.h @@ -62,7 +62,7 @@ extern void savelogs(void); /* libc equivalent */ extern int cache(int); extern char* checkkey(Method*, char*, char*); -extern void fatal(char*); +extern void fatal(char*) __attribute__ ((noreturn)); extern void getpasswd(char*, int); extern void key(int, Method*); extern int outin(char*, char*, int); diff --git a/sys/src/kern/boot/bootip.c b/sys/src/kern/boot/bootip.c index d637fa7..bf11b57 100644 --- a/sys/src/kern/boot/bootip.c +++ b/sys/src/kern/boot/bootip.c @@ -39,6 +39,8 @@ configip(int bargc, char **bargv, int needfs) memmove(arg, bargv, bargc * sizeof(char*)); arg[bargc] = 0; + buf[0] = 0; /* no default for outin */ + print("ipconfig..."); argc = bargc; argv = arg; diff --git a/sys/src/kern/port/devself.c b/sys/src/kern/port/devself.c index 1648461..eb918f2 100644 --- a/sys/src/kern/port/devself.c +++ b/sys/src/kern/port/devself.c @@ -282,20 +282,21 @@ write_working_dir(Proc* p, void *va, long n, int64_t off) } static long -selfread(Chan *c, void *va, long n, int64_t off) +selfread(Chan *c, void *va, long n, int64_t offset) { - int64_t offset; ProcSegment *sg; int i, j; char statbuf[NSEG*STATSIZE]; + + if(offset < 0) + error("invalid offset"); - offset = off; switch(QID(c->qid)){ case Qdir: return devdirread(c, va, n, selfdir, nelem(selfdir), selfgen); case Qsegments: - rlock(&up->seglock); j = 0; + rlock(&up->seglock); for(i = 0; i < NSEG; i++) { sg = up->seg[i]; if(sg == 0) @@ -317,7 +318,7 @@ selfread(Chan *c, void *va, long n, int64_t off) memmove(va, &statbuf[offset], n); return n; case Qwdir: - return read_working_dir(up, va, n, off); + return read_working_dir(up, va, n, offset); case Qpid: return readnum(offset, va, n, up->pid, NUMSIZE); diff --git a/sys/src/kern/port/portfns.h b/sys/src/kern/port/portfns.h index ad8cf0d..a6a4b1d 100644 --- a/sys/src/kern/port/portfns.h +++ b/sys/src/kern/port/portfns.h @@ -65,7 +65,7 @@ void closeegrp(Egrp*); void closefgrp(Fgrp*); void closepgrp(Pgrp*); void closergrp(Rgrp*); -void cmderror(Cmdbuf*, char*); +void cmderror(Cmdbuf*, char*) __attribute__ ((noreturn)); int cmount(Chan**, Chan*, int, char*); #define commonerror() (up->errstr) #define commonuser() (up->user) @@ -125,8 +125,8 @@ int eqchanddq(Chan*, int, uint32_t, Qid, int); int eqqid(Qid, Qid); void error(char*) __attribute__ ((noreturn)); void errorl(char*, long) __attribute__ ((noreturn)); -void errorf(char*, ...); -void exhausted(char*); +void errorf(char*, ...) __attribute__ ((noreturn)); +void exhausted(char*) __attribute__ ((noreturn)); void exit(int) __attribute__ ((noreturn)); uint64_t fastticks(uint64_t*); uint64_t fastticks2us(uint64_t); diff --git a/sys/src/lib/control/control.c b/sys/src/lib/control/control.c index 4e975f0..a286746 100644 --- a/sys/src/lib/control/control.c +++ b/sys/src/lib/control/control.c @@ -243,8 +243,11 @@ controlsetthread(void *v) prevbut=mouse.buttons; break; case ACtl: - _ctlcontrol(cs, str); - free(str); + if(str != nil){ + _ctlcontrol(cs, str); + free(str); + str = nil; + } break; case AExit: threadexits(nil);