sched: ems: Resolve prevent issue of ontime
authorDaeyeong Lee <daeyeong.lee@samsung.com>
Mon, 2 Jul 2018 04:31:07 +0000 (13:31 +0900)
committerYoungmin Nam <youngmin.nam@samsung.com>
Mon, 2 Jul 2018 08:51:42 +0000 (17:51 +0900)
Change-Id: I6e1a00d806def40455d716d650cc813fc1b5b04d
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
kernel/sched/ems/ontime.c

index 0e21fb61083ada3d46f82d6af3f60ccfafdb6823..a773c9b824ac0252ebc38f6f76aabb375e38d555 100644 (file)
@@ -51,7 +51,7 @@ struct ontime_cond {
        struct kobj_attribute   down_threshold_attr;
        struct kobj_attribute   min_residency_attr;
 };
-static struct ontime_cond *ontime_cond;
+static struct ontime_cond *ontime_cond = NULL;
 
 /* Structure of ontime migration environment */
 struct ontime_env {
@@ -757,7 +757,7 @@ static int __init ontime_sysfs_init(void)
        step = 0;
        cond = ontime_cond;
        while (cond) {
-               char buf[20];
+               char buf[25];
                char *name;
 
                /* If ontime is disabled in this step, do not create sysfs node */
@@ -765,7 +765,7 @@ static int __init ontime_sysfs_init(void)
                        goto skip;
 
                /* Init up_threshold node */
-               sprintf(buf, "up_threshold_step%d", step);
+               snprintf(buf, sizeof(buf), "up_threshold_step%d", step);
                name = kstrdup(buf, GFP_KERNEL);
                if (!name)
                        goto out;
@@ -775,7 +775,7 @@ static int __init ontime_sysfs_init(void)
                ontime_attrs[i++] = &cond->up_threshold_attr.attr;
 
                /* Init down_threshold node */
-               sprintf(buf, "down_threshold_step%d", step);
+               snprintf(buf, sizeof(buf), "down_threshold_step%d", step);
                name = kstrdup(buf, GFP_KERNEL);
                if (!name)
                        goto out;
@@ -785,7 +785,7 @@ static int __init ontime_sysfs_init(void)
                ontime_attrs[i++] = &cond->down_threshold_attr.attr;
 
                /* Init min_residency node */
-               sprintf(buf, "min_residency_step%d", step);
+               snprintf(buf, sizeof(buf), "min_residency_step%d", step);
                name = kstrdup(buf, GFP_KERNEL);
                if (!name)
                        goto out;