mdev: call index_in_strings on $ACTION only after we checked it for NULL
authorDenys Vlasenko <vda.linux@googlemail.com>
Tue, 2 Apr 2013 12:37:06 +0000 (14:37 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 2 Apr 2013 12:37:06 +0000 (14:37 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
util-linux/mdev.c

index 5fe6bbbdeec4a580670d63b72f176a1e79ec7def..1d741367e93bffa9ddca3bb27fefdb2bcd7d1652 100644 (file)
@@ -1060,15 +1060,15 @@ int mdev_main(int argc UNUSED_PARAM, char **argv)
                 * ACTION can be "add", "remove", "change"
                 * DEVPATH is like "/block/sda" or "/class/input/mice"
                 */
-               action = getenv("ACTION");
-               op = index_in_strings(keywords, action);
                env_devname = getenv("DEVNAME"); /* can be NULL */
-               env_devpath = getenv("DEVPATH");
                G.subsystem = getenv("SUBSYSTEM");
+               action = getenv("ACTION");
+               env_devpath = getenv("DEVPATH");
                if (!action || !env_devpath /*|| !G.subsystem*/)
                        bb_show_usage();
                fw = getenv("FIRMWARE");
                seq = getenv("SEQNUM");
+               op = index_in_strings(keywords, action);
 
                my_pid = getpid();
                open_mdev_log(seq, my_pid);