mdev: call index_in_strings on $ACTION only after we checked it for NULL
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 5fe6bbb..1d74136 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -1060,15 +1060,15 @@
* 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);