Re: [PATCH v2 04/13] PCI: acpiphp: remove 'name' parameter

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

 



* Matthew Wilcox <matthew@xxxxxx>:
> On Tue, Sep 09, 2008 at 04:00:22AM -0600, Alex Chiang wrote:
> > We do not need to manage our own name parameter, especially since
> > the PCI core can change it on our behalf, in the case of duplicate
> > slot names.
> 
> Looks good, just a question ...
> 
> >  	acpiphp_slot->slot = slot;
> > -	snprintf(slot->name, sizeof(slot->name), "%u", slot->acpi_slot->sun);
> > +	scnprintf(name, SLOT_NAME_SIZE, "%u", slot->acpi_slot->sun);
> >  
> 
> What's the difference between snprintf and scnprintf?

I think this may have already been answered somewhere else, but
scnprintf tells you number of characters that actually fits into
the buffer whereas snprintf tells you the number of characters
that _would_ have fit into the buffer it were big enough.

> And why were we bothering to use snprintf anyway?  For when we fall into a
> parallel universe where a u32 can have more than twenty digits?

Well, I think there are some in-flight patches that want to
change sun to a 64 bit value, which makes me think we want to
change SLOT_NAME_SIZE to 21...

/ac

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux