Skip to content

device: the file operations' buffers are not __user #1182

Description

@lneto

(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.

Activity

  1. added
    severity: lowDocumentation, tests or cleanup
    complexity: smallOne line or one file, with a trivial or existing test
    on Sep 26, 2026
  2. added this to the backlog milestone on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity: smallOne line or one file, with a trivial or existing testseverity: lowDocumentation, tests or cleanup

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions