lkml.org 
[lkml]   [2009]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] scsi: ses check name in enclosure_component_register -v2

    dev_set_name will use sprintf to copy the name.
    need to check if the name does valid.

    otherwise will error from device_add later.

    v2: add %s in dev_set_name according to James

    Signed-off-by: Yinghai Lu <yinghai@kernel.org>

    ---
    drivers/misc/enclosure.c | 6 +++---
    1 file changed, 3 insertions(+), 3 deletions(-)

    Index: linux-2.6/drivers/misc/enclosure.c
    ===================================================================
    --- linux-2.6.orig/drivers/misc/enclosure.c
    +++ linux-2.6/drivers/misc/enclosure.c
    @@ -119,7 +119,7 @@ enclosure_register(struct device *dev, c
    edev->edev.class = &enclosure_class;
    edev->edev.parent = get_device(dev);
    edev->cb = cb;
    - dev_set_name(&edev->edev, name);
    + dev_set_name(&edev->edev, "%s", name);
    err = device_register(&edev->edev);
    if (err)
    goto err;
    @@ -255,8 +255,8 @@ enclosure_component_register(struct encl
    ecomp->number = number;
    cdev = &ecomp->cdev;
    cdev->parent = get_device(&edev->edev);
    - if (name)
    - dev_set_name(cdev, name);
    + if (name && name[0])
    + dev_set_name(cdev, "%s", name);
    else
    dev_set_name(cdev, "%u", number);


    \
     
     \ /
      Last update: 2009-05-01 04:17    [W:0.021 / U:121.236 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site