lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7852d6ac-95f0-41ec-8365-d23a2b16b208@kernel.org>
Date: Mon, 23 Jun 2025 20:31:38 +0200
From: Hans de Goede <hansg@...nel.org>
To: Abdelrahman Fekry <abdelrahmanfekry375@...il.com>, andy@...nel.org,
 mchehab@...nel.org, sakari.ailus@...ux.intel.com, gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
 linux-staging@...ts.linux.dev, skhan@...uxfoundation.org,
 linux-kernel-mentees@...ts.linux.dev
Subject: Re: [PATCH] staging: media: atomisp: Replace scnprintf with
 sysfs_emit in bo_show

Hi,

On 21-Jun-25 8:29 AM, Abdelrahman Fekry wrote:
> Convert buffer output to use sysfs_emit/sysfs_emit_at API for safer
> PAGE_SIZE handling and standardized sysfs output.
> 
> Signed-off-by: Abdelrahman Fekry <abdelrahmanfekry375@...il.com>
> ---
>  drivers/staging/media/atomisp/pci/hmm/hmm.c | 24 ++++++---------------
>  1 file changed, 7 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c
> index 84102c3aaf97..cae1fccd06af 100644
> --- a/drivers/staging/media/atomisp/pci/hmm/hmm.c
> +++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c
> @@ -37,51 +37,41 @@ static const char hmm_bo_type_string[] = "pv";
>  static ssize_t bo_show(struct device *dev, struct device_attribute *attr,
>  		       char *buf, struct list_head *bo_list, bool active)
>  {

<snip>

As Andy already mentioned you really should try to first better understand
the code before changing it.

In this case this code is used for 2 custom sysfs attributes called
"active_bo" and "free_bo".

sysfs attributes are custom userspace API and we really want to remove
all custom userspace APIs from this driver before moving it out of
drivers/staging

Instead everything should be done through existing standard kernels
API, mostly the standard v4l2 API.

Note this is already mentioned in drivers/staging/media/atomisp/TODO
although these specific sysfs attributes are not named:

"""
TODO
====

1. Items which MUST be fixed before the driver can be moved out of staging:

* Remove/disable private IOCTLs

* Remove/disable custom v4l2-ctrls

* Remove custom sysfs files created by atomisp_drvfs.c
"""

In this case the "active_bo" and "free_bo" sysfs attributes seem
to be there for debugging purposes only and they can simply be removed.

So instead of replacing scnprintf you should write a new patch
removing everything starting at:

<--- start removing code here --->
/*
 * p: private
 * v: vmalloc

...

static struct attribute_group atomisp_attribute_group[] = {
        {.attrs = sysfs_attrs_ctrl },
};
<--- end removing code here --->

and then also remove the sysfs_create_group() and
sysfs_remove_group() calls.

After writing that patch maybe you can also take a look at tackling
the "Remove custom sysfs files created by atomisp_drvfs.c" TODO
list item?

Regards,

Hans






Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ