Re: is overwriting user data acceptable

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

 



Hi Rik,

Thanks for the information. I have coded it using uint32_t/ uint8_t data types.
Should I consider it ok and should I change them to u32.

Regards.
Bhanu

On Fri, Jul 4, 2008 at 6:14 PM, Rik van Riel <riel@xxxxxxxxxxx> wrote:
> On Fri, 4 Jul 2008 17:38:25 -0700
> "bhanu nani" <bhanu.lnxnew@xxxxxxxxx> wrote:
>
>> if I have an ioctl that passes me some data in a structure which
>> have to process and return the result as a field in the structure.
>> Is it acceptable if I copy the entire structure with copy_to_user()
>> instead of copying only the field with with put_user()?
>> Because doing so I am overwriting the user data which is ok for my
>> application but does Linux treat overwriting data in this fashion?
>
> This is a fairly normal thing.
>
> However, you will want to make sure that your data
> structure is the same on 32 and 64 bit systems,
> because someone may end up using it on a 64 bit
> kernel in the future, with a 32 bit program.
>
> PPC64 tends to run 32 bit PPC programs, after all.
>
> So you'll want to make sure the data structure uses
> data types that are the same on 32 and 64 bit (like
> u32) instead of data types that change depending
> on how the system is compiled (like unsigned long).
>
> --
> All rights reversed.
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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