libsys: resolve Coverity warnings

This commit is contained in:
David van Moolenbroek 2012-08-07 13:10:16 +02:00
parent 49aed1ad97
commit ebc85e54c4
5 changed files with 7 additions and 8 deletions

View file

@ -84,6 +84,4 @@ double getidle(void)
return rfp; return rfp;
} }
running = !running;
} }

View file

@ -146,7 +146,7 @@ void procentry (char *name)
} }
/* Set values for new slot. */ /* Set values for new slot. */
cprof_slot = &cprof_tbl[control.slots_used++]; cprof_slot = &cprof_tbl[control.slots_used++];
strcpy(cprof_slot->cpath, cpath); strlcpy(cprof_slot->cpath, cpath, sizeof(cprof_slot->cpath));
cprof_slot->calls = 1; cprof_slot->calls = 1;
/* Update index. */ /* Update index. */

View file

@ -21,7 +21,6 @@ int sched_inherit(endpoint_t scheduler_e,
assert(_ENDPOINT_P(scheduler_e) >= 0); assert(_ENDPOINT_P(scheduler_e) >= 0);
assert(_ENDPOINT_P(schedulee_e) >= 0); assert(_ENDPOINT_P(schedulee_e) >= 0);
assert(_ENDPOINT_P(parent_e) >= 0); assert(_ENDPOINT_P(parent_e) >= 0);
assert(maxprio >= 0);
assert(maxprio < NR_SCHED_QUEUES); assert(maxprio < NR_SCHED_QUEUES);
assert(newscheduler_e); assert(newscheduler_e);

View file

@ -58,7 +58,7 @@ void sef_startup()
&priv_flags); &priv_flags);
if ( r != OK) { if ( r != OK) {
sef_self_endpoint = SELF; sef_self_endpoint = SELF;
sprintf(sef_self_name, "%s", "Unknown"); strlcpy(sef_self_name, "Unknown", sizeof(sef_self_name));
} }
sef_self_priv_flags = priv_flags; sef_self_priv_flags = priv_flags;
old_endpoint = NONE; old_endpoint = NONE;
@ -302,8 +302,9 @@ char* sef_debug_header(void)
{ {
/* Build and return a SEF debug header. */ /* Build and return a SEF debug header. */
sef_debug_refresh_params(); sef_debug_refresh_params();
sprintf(sef_debug_header_buff, "%s: time = %ds %06dus", snprintf(sef_debug_header_buff, sizeof(sef_debug_header_buff),
sef_self_name, (int) sef_debug_time_sec, (int) sef_debug_time_us); "%s: time = %ds %06dus", sef_self_name, (int) sef_debug_time_sec,
(int) sef_debug_time_us);
return sef_debug_header_buff; return sef_debug_header_buff;
} }

View file

@ -18,7 +18,8 @@ void ser_putc(char c)
thr= COM1_THR; thr= COM1_THR;
for (i= 0; i<10000; i++) for (i= 0; i<10000; i++)
{ {
sys_inb(lsr, &b); if (sys_inb(lsr, &b) != OK)
return;
if (b & LSR_THRE) if (b & LSR_THRE)
break; break;
} }