kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* IOCtl argument check
@ 2018-09-17 14:48 Subhashini Rao Beerisetty
  0 siblings, 0 replies; only message in thread
From: Subhashini Rao Beerisetty @ 2018-09-17 14:48 UTC (permalink / raw)
  To: kernelnewbies

Hi All,



Can someone clarify me on IOCtl argument check.



Kernel code has few IOCtl?s with a pointer to structure as an arguments.
For example please consider the below mentioned IOCtl?s.



#define MB862XX_L1_SET_CFG _IOW(MB862XX_BASE, 1, struct mb862xx_l1_cfg*)

#define MB862XX_L1_GET_CFG _IOR(MB862XX_BASE, 0, struct mb862xx_l1_cfg*)

#define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, struct agp_info*)



If user space passes a structure object instead of pointer to struct, what
should be the return value from kernel code?



How to debug this kind scenario?s if copy_{to,from}_user returns
success(i.e. ?0?)?



The IOCtl?s are represented in 32-bits. Out of these 13 bits(bits 29-16)
are reserved for size of argument. If user space passes an object instead
of pointer and assume size of the structure is not equal to size of the
pointer, then IOCtl decoding should result a different value, right? So for
this case, does user space IOCtl calls the corresponding driver IOCtl
function?



Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180917/4016acd8/attachment.html>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-09-17 14:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-17 14:48 IOCtl argument check Subhashini Rao Beerisetty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).