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;
}
running = !running;
}

View file

@ -146,7 +146,7 @@ void procentry (char *name)
}
/* Set values for new slot. */
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;
/* Update index. */

View file

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

View file

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

View file

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