]> Zhao Yanbai Git Server - minix.git/commitdiff
libsys: resolve Coverity warnings
authorDavid van Moolenbroek <david@minix3.org>
Tue, 7 Aug 2012 11:10:16 +0000 (13:10 +0200)
committerDavid van Moolenbroek <david@minix3.org>
Wed, 8 Aug 2012 22:16:36 +0000 (00:16 +0200)
lib/libsys/getidle.c
lib/libsys/profile.c
lib/libsys/sched_start.c
lib/libsys/sef.c
lib/libsys/ser_putc.c

index af37d7b0d397c32412248c099d15df7d9e8ddf01..989eac53a11c5ffad07cda29a01bfe1cf9ca700e 100644 (file)
@@ -84,6 +84,4 @@ double getidle(void)
 
        return rfp;
   }
-
-  running = !running;
 }
index 86032a9be206278fb10c4c7525bbb3feb63f1101..3acbbc8a7c58aed325c50a7df3763f516280e477 100644 (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. */
index 2b49fc95f6e7c73e140124f89bf4c8ad7514a875..ce012267038664f9fe89aa7838a88a4cc99a682e 100644 (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);
        
index c625ce1b7d1f5464020735582023532ceb66101a..e964fa70b0add17017a3ff9e1272666780bf1a92 100644 (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;
 }
index 133b713c1c6f4a4f0c82cfdab0bccb021f7f5a55..87b12e858dc03cec4cefd064c729a4beba5e01ce 100644 (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;
         }