AW: [PATCH v1 1/1] [SCSI] enclosure: Handle non-unique element descriptors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Von: linux-scsi-owner@xxxxxxxxxxxxxxx [linux-scsi-owner@xxxxxxxxxxxxxxx]" im Auftrag von "James Bottomley [James.Bottomley@xxxxxxxxxxxxxxxxxxxxx]
> Gesendet: Mittwoch, 1. Oktober 2014 17:31
> An: Markus Stockhausen
> Cc: linux-scsi@xxxxxxxxxxxxxxx
> Betreff: Re: [PATCH v1 1/1] [SCSI] enclosure: Handle non-unique element descriptors
>
> On Wed, 2014-10-01 at 15:10 +0000, Markus Stockhausen wrote:
> > [SCSI] enclosure: Handle non-unique element descriptors
> ...
> > +
> > +     if (name && name[0]) {
> > +             /* Some hardware (e.g. enclosure in RX300 S6) has components
> > +              * with non unique names. Registering duplicates in sysfs
> > +              * will lead to warnings during bootup. So make the names
> > +              * unique by appending consecutive numbers -1, -2, ... */
> > +             i = 1;
> > +             snprintf(newname, COMPONENT_NAME_SIZE,
> > +                      "%s", name);
> > +             while (i < 255 &&
> > +                    enclosure_component_find_by_name (edev, newname))
> > +                     snprintf(newname, COMPONENT_NAME_SIZE,
> > +                              "%s-%i", name, i++);
> 
> We need error handling here (what happens when i becomes 255).  Since
> it's iterating through a unique name space, I think you can just let the
> loop be unbounded because if it's not, the system will run out of memory
> before we get into an apparently endless loop.
> 
> After fixing this, you can add my acked-by.
> 
> James

Hi James.

Just to make sure I get it right. My intention was to ensure that we will
not loop endlessly. Thinking about the corner cases I was unsure if we 
might encounter component names with up to 63 chars. If yes appending 
the numbers will not not change the generated names throughout the
loop. So ensure that we will stop somewhere by giving it an upper bound. 
In the error case we will have the same behaviour as now. Creating an 
already existing filename.

You are more experienced with that. So if i drop the "i<255" it will be 
fine and can be implemented?

Markus
****************************************************************************
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe dieser Mail ist nicht gestattet.

�ber das Internet versandte E-Mails können unter fremden Namen erstellt oder
manipuliert werden. Deshalb ist diese als E-Mail verschickte Nachricht keine
rechtsverbindliche Willenserklärung.

Collogia
Unternehmensberatung AG
Ubierring 11
D-50678 Köln

Vorstand:
Kadir Akin
Dr. Michael Höhnerbach

Vorsitzender des Aufsichtsrates:
Hans Kristian Langva

Registergericht: Amtsgericht Köln
Registernummer: HRB 52 497

This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.

e-mails sent over the internet may have been written under a wrong name or
been manipulated. That is why this message sent as an e-mail is not a
legally binding declaration of intention.

Collogia
Unternehmensberatung AG
Ubierring 11
D-50678 Köln

executive board:
Kadir Akin
Dr. Michael Höhnerbach

President of the supervisory board:
Hans Kristian Langva

Registry office: district court Cologne
Register number: HRB 52 497

****************************************************************************

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux