[Toybox] Assigned value is garbage or undefined

Cynt Rynt cynt1728 at gmail.com
Tue Nov 18 15:13:17 PST 2014


Bug reported by the clang static analyzer.

File: /home/cindy/toybox-2014-11-18/toys/other/chvt.c
Line: 24

Description: Assigned value is garbage or undefined
File: /home/cindy/toybox-2014-11-18/toys/other/losetup.c
Line: 64
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20141118/cc86daf9/attachment-0002.htm>
-------------- next part --------------
diff -r b5968bffb65c toys/other/chvt.c
--- a/toys/other/chvt.c	Tue Nov 18 04:25:27 2014 -0600
+++ b/toys/other/chvt.c	Tue Nov 18 14:58:00 2014 -0800
@@ -21,7 +21,7 @@
 
 void chvt_main(void)
 {
-  int vtnum, fd = fd;
+  int vtnum, fd = -2;
   char *consoles[]={"/dev/console", "/dev/vc/0", "/dev/tty", NULL}, **cc;
 
   vtnum=atoi(*toys.optargs);
-------------- next part --------------
diff -r b5968bffb65c toys/other/losetup.c
--- a/toys/other/losetup.c	Tue Nov 18 04:25:27 2014 -0600
+++ b/toys/other/losetup.c	Tue Nov 18 14:58:00 2014 -0800
@@ -61,7 +61,7 @@
 static void loopback_setup(char *device, char *file)
 {
   struct loop_info64 *loop = (void *)(toybuf+32);
-  int lfd = -1, ffd = ffd;
+  int lfd = -1, ffd = -1;
   unsigned flags = toys.optflags;
 
   // Open file (ffd) and loop device (lfd)


More information about the Toybox mailing list