<div dir="ltr"><div dir="ltr"><div dir="ltr"><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">Hi All,</font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3"> </font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">Can someone clarify me on IOCtl argument check<span><span>.</span></span></font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3"> </font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">Kernel code has few IOCtl’s with a pointer to structure as
an arguments. For example please consider the below mentioned IOCtl’s.</font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3"> </font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">#define MB862XX_L1_SET_CFG
_IOW(MB862XX_BASE, 1, struct mb862xx_l1_cfg*)</font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">#define MB862XX_L1_GET_CFG
_IOR(MB862XX_BASE, 0, struct mb862xx_l1_cfg*)</font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">#define AGPIOC_INFO _IOR
(AGPIOC_BASE, 0, struct agp_info*)</font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3"> </font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">If user space passes a structure object instead of pointer
to struct, what should be the return value from kernel code?</font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3"> </font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">How to debug this kind scenario’s if copy_{to,from}_user
returns success(i.e. “0”)?</font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3"> </font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">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?</font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3"> </font></p><font color="#000000" face="Times New Roman" size="3">
</font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">Thanks<span></span></font></p><font color="#000000" face="Times New Roman" size="3">
</font></div></div></div>