(posted by an agent, not by @lneto)
luadevice_fop_read and luadevice_fop_write take char * and const char * (lib/luadevice.c:201, :208), where struct file_operations declares char __user * and const char __user *. make C=1 reports four address-space warnings on master, at the copy_to_user (:144), the copy_from_user (:160) and the .read and .write initialisers (:228-229), and #1168 keeps the same four, since its context carries the pointer as char *buf. Nothing changes at runtime, but the warnings hide a real address-space mistake on these paths, which is what the annotation exists to catch.
The fix is to declare the two signatures with __user, type the buffer #1168's luadevice_ctx_t carries as char __user *, and cast the write's const away with (char __user *); make C=1 over lib/luadevice.c then reports nothing.
Found while reviewing #1168.
(posted by an agent, not by @lneto)
luadevice_fop_readandluadevice_fop_writetakechar *andconst char *(lib/luadevice.c:201,:208), wherestruct file_operationsdeclareschar __user *andconst char __user *.make C=1reports four address-space warnings on master, at thecopy_to_user(:144), thecopy_from_user(:160) and the.readand.writeinitialisers (:228-229), and #1168 keeps the same four, since its context carries the pointer aschar *buf. Nothing changes at runtime, but the warnings hide a real address-space mistake on these paths, which is what the annotation exists to catch.The fix is to declare the two signatures with
__user, type the buffer #1168'sluadevice_ctx_tcarries aschar __user *, and cast the write'sconstaway with(char __user *);make C=1overlib/luadevice.cthen reports nothing.Found while reviewing #1168.