qa: fix a few issues detected by coverity
This commit is contained in:
parent
d4157c7e24
commit
c4fb99ec38
|
@ -25,7 +25,7 @@ uartpci(int ctlrno, Pcidev* p, int barno, int n, int freq, char* name)
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
head = uart = malloc(sizeof(Uart)*n);
|
head = uart = mallocz(sizeof(Uart)*n, 1);
|
||||||
|
|
||||||
for(i = 0; i < n; i++){
|
for(i = 0; i < n; i++){
|
||||||
ctlr = i8250alloc(io, p->intl, p->tbdf);
|
ctlr = i8250alloc(io, p->intl, p->tbdf);
|
||||||
|
|
|
@ -62,7 +62,7 @@ extern void savelogs(void);
|
||||||
/* libc equivalent */
|
/* libc equivalent */
|
||||||
extern int cache(int);
|
extern int cache(int);
|
||||||
extern char* checkkey(Method*, char*, char*);
|
extern char* checkkey(Method*, char*, char*);
|
||||||
extern void fatal(char*);
|
extern void fatal(char*) __attribute__ ((noreturn));
|
||||||
extern void getpasswd(char*, int);
|
extern void getpasswd(char*, int);
|
||||||
extern void key(int, Method*);
|
extern void key(int, Method*);
|
||||||
extern int outin(char*, char*, int);
|
extern int outin(char*, char*, int);
|
||||||
|
|
|
@ -39,6 +39,8 @@ configip(int bargc, char **bargv, int needfs)
|
||||||
memmove(arg, bargv, bargc * sizeof(char*));
|
memmove(arg, bargv, bargc * sizeof(char*));
|
||||||
arg[bargc] = 0;
|
arg[bargc] = 0;
|
||||||
|
|
||||||
|
buf[0] = 0; /* no default for outin */
|
||||||
|
|
||||||
print("ipconfig...");
|
print("ipconfig...");
|
||||||
argc = bargc;
|
argc = bargc;
|
||||||
argv = arg;
|
argv = arg;
|
||||||
|
|
|
@ -282,20 +282,21 @@ write_working_dir(Proc* p, void *va, long n, int64_t off)
|
||||||
}
|
}
|
||||||
|
|
||||||
static long
|
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;
|
ProcSegment *sg;
|
||||||
int i, j;
|
int i, j;
|
||||||
char statbuf[NSEG*STATSIZE];
|
char statbuf[NSEG*STATSIZE];
|
||||||
|
|
||||||
offset = off;
|
if(offset < 0)
|
||||||
|
error("invalid offset");
|
||||||
|
|
||||||
switch(QID(c->qid)){
|
switch(QID(c->qid)){
|
||||||
case Qdir:
|
case Qdir:
|
||||||
return devdirread(c, va, n, selfdir, nelem(selfdir), selfgen);
|
return devdirread(c, va, n, selfdir, nelem(selfdir), selfgen);
|
||||||
case Qsegments:
|
case Qsegments:
|
||||||
rlock(&up->seglock);
|
|
||||||
j = 0;
|
j = 0;
|
||||||
|
rlock(&up->seglock);
|
||||||
for(i = 0; i < NSEG; i++) {
|
for(i = 0; i < NSEG; i++) {
|
||||||
sg = up->seg[i];
|
sg = up->seg[i];
|
||||||
if(sg == 0)
|
if(sg == 0)
|
||||||
|
@ -317,7 +318,7 @@ selfread(Chan *c, void *va, long n, int64_t off)
|
||||||
memmove(va, &statbuf[offset], n);
|
memmove(va, &statbuf[offset], n);
|
||||||
return n;
|
return n;
|
||||||
case Qwdir:
|
case Qwdir:
|
||||||
return read_working_dir(up, va, n, off);
|
return read_working_dir(up, va, n, offset);
|
||||||
|
|
||||||
case Qpid:
|
case Qpid:
|
||||||
return readnum(offset, va, n, up->pid, NUMSIZE);
|
return readnum(offset, va, n, up->pid, NUMSIZE);
|
||||||
|
|
|
@ -65,7 +65,7 @@ void closeegrp(Egrp*);
|
||||||
void closefgrp(Fgrp*);
|
void closefgrp(Fgrp*);
|
||||||
void closepgrp(Pgrp*);
|
void closepgrp(Pgrp*);
|
||||||
void closergrp(Rgrp*);
|
void closergrp(Rgrp*);
|
||||||
void cmderror(Cmdbuf*, char*);
|
void cmderror(Cmdbuf*, char*) __attribute__ ((noreturn));
|
||||||
int cmount(Chan**, Chan*, int, char*);
|
int cmount(Chan**, Chan*, int, char*);
|
||||||
#define commonerror() (up->errstr)
|
#define commonerror() (up->errstr)
|
||||||
#define commonuser() (up->user)
|
#define commonuser() (up->user)
|
||||||
|
@ -125,8 +125,8 @@ int eqchanddq(Chan*, int, uint32_t, Qid, int);
|
||||||
int eqqid(Qid, Qid);
|
int eqqid(Qid, Qid);
|
||||||
void error(char*) __attribute__ ((noreturn));
|
void error(char*) __attribute__ ((noreturn));
|
||||||
void errorl(char*, long) __attribute__ ((noreturn));
|
void errorl(char*, long) __attribute__ ((noreturn));
|
||||||
void errorf(char*, ...);
|
void errorf(char*, ...) __attribute__ ((noreturn));
|
||||||
void exhausted(char*);
|
void exhausted(char*) __attribute__ ((noreturn));
|
||||||
void exit(int) __attribute__ ((noreturn));
|
void exit(int) __attribute__ ((noreturn));
|
||||||
uint64_t fastticks(uint64_t*);
|
uint64_t fastticks(uint64_t*);
|
||||||
uint64_t fastticks2us(uint64_t);
|
uint64_t fastticks2us(uint64_t);
|
||||||
|
|
|
@ -243,8 +243,11 @@ controlsetthread(void *v)
|
||||||
prevbut=mouse.buttons;
|
prevbut=mouse.buttons;
|
||||||
break;
|
break;
|
||||||
case ACtl:
|
case ACtl:
|
||||||
|
if(str != nil){
|
||||||
_ctlcontrol(cs, str);
|
_ctlcontrol(cs, str);
|
||||||
free(str);
|
free(str);
|
||||||
|
str = nil;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case AExit:
|
case AExit:
|
||||||
threadexits(nil);
|
threadexits(nil);
|
||||||
|
|
Loading…
Reference in New Issue