ge2d: add return value check for kstrtoint call [1/1]
authorJian Cao <jian.cao@amlogic.com>
Thu, 27 Jun 2019 06:20:46 +0000 (14:20 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Fri, 5 Jul 2019 03:04:42 +0000 (20:04 -0700)
PD#OTT-4875

Problem:
missing return value check for kstrtoint

Solution:
add this check for kstrtoint

Verify:
verified on g12b-w400

Change-Id: I0515b4b445c78d950201df6547e83578cac32d16
Signed-off-by: Jian Cao <jian.cao@amlogic.com>
drivers/amlogic/media/common/ge2d/ge2d_main.c

index 0749bd4..3af1715 100644 (file)
@@ -151,6 +151,11 @@ static ssize_t dump_reg_enable_store(struct class *cla,
        int ret = 0;
 
        ret = kstrtoint(buf, 0, &res);
+       if (ret) {
+               ge2d_log_err("kstrtoint err\n");
+               return -EINVAL;
+       }
+
        ge2d_log_info("ge2d dump_reg_enbale: %d->%d\n",
                ge2d_dump_reg_enable, res);
        ge2d_dump_reg_enable = res;
@@ -173,6 +178,11 @@ static ssize_t dump_reg_cnt_store(struct class *cla,
        int ret = 0;
 
        ret = kstrtoint(buf, 0, &res);
+       if (ret) {
+               ge2d_log_err("kstrtoint err\n");
+               return -EINVAL;
+       }
+
        ge2d_log_info("ge2d dump_reg: %d->%d\n", ge2d_dump_reg_cnt, res);
        ge2d_dump_reg_cnt = res;
        return count;
@@ -193,6 +203,11 @@ static ssize_t log_level_store(struct class *cla,
        int ret = 0;
 
        ret = kstrtoint(buf, 0, &res);
+       if (ret) {
+               ge2d_log_err("kstrtoint err\n");
+               return -EINVAL;
+       }
+
        ge2d_log_info("ge2d log_level: %d->%d\n", ge2d_log_level, res);
        ge2d_log_level = res;