<div dir="ltr"><div class="gmail_extra"><span style="font-family:arial,sans-serif;font-size:13px">(Forget the last e-mail, please, stupid Gmail)</span><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div>
<div class="gmail_extra"><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div class="gmail_extra"><span style="font-family:arial,sans-serif;font-size:13px">Hi, </span><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">
I'm looking for some information about :</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><span style="font-family:arial,sans-serif;font-size:13px">struct kobj_attribute {</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px"> struct attribute attr;</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px"> ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, char *buf);</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px"> ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count);</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">};</span><div style="font-family:arial,sans-serif;font-size:13px"><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">My function to handle the operation:</div>
<div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra"><div class="gmail_extra">static ssize_t my_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) {</div>
<div class="gmail_extra"><span style="white-space:pre-wrap">        </span>char *buffer;</div><div class="gmail_extra"> </div><div class="gmail_extra"> buffer = (char*) kcalloc(count, sizeof(char), GFP_KERNEL);</div>
<div class="gmail_extra"><br></div><div class="gmail_extra"> copy_from_user(buffer, buf, count);</div><div class="gmail_extra"> .....</div><div class="gmail_extra"> .....</div><div class="gmail_extra">
etc....</div>
<div class="gmail_extra">}</div></div><div class="gmail_extra"><br></div><div class="gmail_extra">So, this <b>const char *buf, </b>where ti come from ? Kernel space? </div><div class="gmail_extra">My copy_from_user it's not working. Should return zero.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">There any Macro or function to test if the pointer <b>buf </b>is a kernel pointer ? </div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks </div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Lucas Tanure</div></div></div></div></div>