浏览代码

Input: libps2 - warn instead of oopsing when passed bad arguments

This is more user-friendly and also fixes Coverity #id 249

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Dmitry Torokhov 19 年之前
父节点
当前提交
95349fe814
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      drivers/input/serio/libps2.c

+ 5 - 0
drivers/input/serio/libps2.c

@@ -177,6 +177,11 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command)
 		return -1;
 	}
 
+	if (send && !param) {
+		WARN_ON(1);
+		return -1;
+	}
+
 	mutex_lock_nested(&ps2dev->cmd_mutex, SINGLE_DEPTH_NESTING);
 
 	serio_pause_rx(ps2dev->serio);