Date:2011-11-19 15:39:54 (10 years 10 months ago)
Author:Paul Cercueil
Commit:1ad417bd85438699842cc8cbed60859ad735e31f
Message:fbcon: use kstrtoint instead of deprecated function simple_strtoul.

Files: drivers/video/console/fbcon.c (9 diffs)

Change Details

drivers/video/console/fbcon.c
436436static int __init fb_console_setup(char *this_opt)
437437{
438438    char *options;
439    int i, j;
439    int i, j, ret;
440440
441441    if (!this_opt || !*this_opt)
442442        return 1;
...... 
446446            strcpy(fontname, options + 5);
447447
448448        if (!strncmp(options, "scrollback:", 11)) {
449            char *k;
449450            options += 11;
450            if (*options) {
451                fbcon_softback_size = simple_strtoul(options, &options, 0);
452                if (*options == 'k' || *options == 'K') {
453                    fbcon_softback_size *= 1024;
454                    options++;
455                }
456                if (*options != ',')
457                    return 1;
458                options++;
459            } else
460                return 1;
451            k = options;
452
453            while (*k != '\0' && *k != 'k' && *k != 'K')
454                k++;
455
456            /* Clear the 'k' or 'K' suffix to
457             * prevent errors with kstrtoint */
458            if (*k != '\0')
459                *k++ = '\0';
460            else
461                k = NULL;
462
463            ret = kstrtoint(options, 0, &fbcon_softback_size);
464
465            if (!ret && k)
466                fbcon_softback_size *= 1024;
467
468            /* (k && *k): Check for garbage after the suffix */
469            if (ret || (k && *k))
470                printk(KERN_WARNING "fbcon: scrollback: incorrect value.\n");
461471        }
462472
463473        if (!strncmp(options, "map:", 4)) {
...... 
477487        }
478488
479489        if (!strncmp(options, "vc:", 3)) {
490            char *dash;
480491            options += 3;
481            if (*options)
482                first_fb_vc = simple_strtoul(options, &options, 10) - 1;
483            if (first_fb_vc < 0)
484                first_fb_vc = 0;
485            if (*options++ == '-')
486                last_fb_vc = simple_strtoul(options, &options, 10) - 1;
487            fbcon_is_default = 0;
488        }
492
493            dash = strchr(options, '-');
494            if (dash)
495                *dash++ = '\0';
496
497            ret = kstrtoint(options, 10, &first_fb_vc);
498            if (!ret) {
499                if (--first_fb_vc < 0)
500                    first_fb_vc = 0;
501
502                if (dash) {
503                    ret = kstrtoint(dash, 10,
504                                &last_fb_vc);
505                    if (!ret)
506                        last_fb_vc--;
507                }
508            }
509
510            if (!ret)
511                fbcon_is_default = 0;
512            else
513                printk(KERN_WARNING "fbcon: vc: incorrect value.\n");
514        }
489515
490516        if (!strncmp(options, "rotate:", 7)) {
491517            options += 7;
492            if (*options)
493                initial_rotation = simple_strtoul(options, &options, 0);
494            if (initial_rotation > 3)
495                initial_rotation = 0;
518            ret = kstrtoint(options, 0, &initial_rotation);
519            if (!ret) {
520                if (initial_rotation > 3)
521                    initial_rotation = 0;
522            } else {
523                printk(KERN_WARNING "fbcon: rotate: incorrect value.\n");
524            }
496525        }
497526    }
498527    return 1;
...... 
33143343{
33153344    struct fb_info *info;
33163345    int rotate, idx;
3317    char **last = NULL;
33183346
33193347    if (fbcon_has_exited)
33203348        return count;
...... 
33263354        goto err;
33273355
33283356    info = registered_fb[idx];
3329    rotate = simple_strtoul(buf, last, 0);
3357    if (kstrtoint(buf, 0, &rotate))
3358        goto err;
33303359    fbcon_rotate(info, rotate);
33313360err:
33323361    console_unlock();
...... 
33393368{
33403369    struct fb_info *info;
33413370    int rotate, idx;
3342    char **last = NULL;
33433371
33443372    if (fbcon_has_exited)
33453373        return count;
...... 
33513379        goto err;
33523380
33533381    info = registered_fb[idx];
3354    rotate = simple_strtoul(buf, last, 0);
3382    if (kstrtoint(buf, 0, &rotate))
3383        goto err;
33553384    fbcon_rotate_all(info, rotate);
33563385err:
33573386    console_unlock();
...... 
34143443{
34153444    struct fb_info *info;
34163445    int blink, idx;
3417    char **last = NULL;
34183446
34193447    if (fbcon_has_exited)
34203448        return count;
...... 
34303458    if (!info->fbcon_par)
34313459        goto err;
34323460
3433    blink = simple_strtoul(buf, last, 0);
3461    if (kstrtoint(buf, 0, &blink))
3462        goto err;
34343463
34353464    if (blink) {
34363465        fbcon_cursor_noblink = 0;

Archive Download the corresponding diff file



interactive