RE: device class related

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

 



Thomas:

Just about the same time as your message, I was reading about it in an
online document and it said: 

.....
"The store() function has a similar interface; the additional size parameter
gives the length of the data received from user space. Never forget that
buffer contains unchecked, user-supplied data; treat it carefully and be
sure that it fits whatever format you require. The return value should
normally be the same as size, unless something has gone wrong"
.....

So I returned the size parameter and it worked. 

Thanks for your help.

Suri



> -----Original Message-----
> From: kernelnewbies-bounce@xxxxxxxxxxxx [mailto:kernelnewbies-
> bounce@xxxxxxxxxxxx] On Behalf Of Thomas Petazzoni
> Sent: Friday, February 03, 2006 11:22 AM
> To: kernelnewbies@xxxxxxxxxxxx
> Subject: Re: device class related
> 
> Hi,
> 
> Suresh Shelvapille a écrit :
> 
> > it appears as though the store_portstate function is getting called in
> an
> > infinite loop!
> >
> > What causes this?
> 
> I'm not an expert of the device infrastructure of the Linux kernel, but
> I suspect it's because you don't return the number of bytes that you
> have taken into account.
> 
> The store() method has the following prototype:
> 
> ssize_t (*store)(struct class_device *, const char * buf, size_t count);
> 
> So you must return the number of bytes that have been written.
> 
> Sincerly,
> 
> Thomas
> --
> Thomas Petazzoni
> thomas.petazzoni@xxxxxxxx
> 
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux