Re: [RFC PATCH] /dev/mem: Add initial documentation of memory_open() and mem_fops
From: Greg KH
Date: Thu Aug 21 2025 - 13:37:50 EST
On Thu, Aug 21, 2025 at 07:04:19PM +0200, Gabriele Paoloni wrote:
> This patch proposes initial kernel-doc documentation for memory_open()
> and most of the functions in the mem_fops structure.
> The format used for the **Description** intends to define testable
> function's expectations and Assumptions of Use to be met by the
> user of the function.
>
> Signed-off-by: Gabriele Paoloni <gpaoloni@xxxxxxxxxx>
> ---
> I have a couple of comments from this documentation activity:
> 1) Shouldn't the check in read_mem() <<if (p != *ppos)>> return
> -EFBIG (as done in write_mem())?
I think that check implies you don't want to read any more memory,
right? Try changing it and see what happens :)
> 2) There is a note in memory_lseek() that states the return value
> to be (0) for negative addresses, however I cannot see how that
> would happen in the current implementation...
How that you could have a negative address, or how you would return 0?
Also, you should cc: the mm developers, they touch this file all the
time and know it quite well (recent changes to /dev/zero just got added
in the past few days from them.)
thanks,
greg k-h