Re: [PATCH v8 8/8] drm: Replace strcpy() with strscpy()

2024-09-12 Thread Justin Stitt
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c > @@ -1412,7 +1412,7 @@ static bool record_context(struct > i915_gem_context_coredump *e, > rcu_read_lock(); > task = pid_task(ctx->pid, PIDTYPE_PID); > if (task) { > - strcpy(e->comm, task->comm); >

Re: [PATCH v8 7/8] net: Replace strcpy() with strscpy()

2024-09-12 Thread Justin Stitt
t.ipv6.neigh.%s.%s_ms instead\n", > warncomm, func, > dev_name, ctl->procname, > -- > 2.43.5 > > Reviewed-by: Justin Stitt Thanks Justin

Re: [PATCH v8 4/8] bpftool: Ensure task comm is always NUL-terminated

2024-09-12 Thread Justin Stitt
Hi, On Wed, Aug 28, 2024 at 11:03:17AM GMT, Yafang Shao wrote: > Let's explicitly ensure the destination string is NUL-terminated. This way, > it won't be affected by changes to the source string. > > Signed-off-by: Yafang Shao > Reviewed-by: Quentin Monnet > --- > tools/bpf/bpftool/pids.c | 2

Re: [PATCH v8 2/8] auditsc: Replace memcpy() with strscpy()

2024-09-12 Thread Justin Stitt
mcpy(axp->target_comm[axp->pid_count], t->comm, TASK_COMM_LEN); > + strscpy(axp->target_comm[axp->pid_count], t->comm); > axp->pid_count++; > > return 0; > -- > 2.43.5 > Good usage of two-argument strscpy(). This helps towards [1]. Reviewed-by: Justin Stitt [1]: https://github.com/KSPP/linux/issues/90 Thanks Justin

Re: [PATCH v6 7/9] tracing: Replace strncpy() with strscpy()

2024-08-13 Thread Justin Stitt
On Tue, Aug 13, 2024 at 3:19 PM Justin Stitt wrote: > > Hi, > > On Mon, Aug 12, 2024 at 10:29:31AM GMT, Yafang Shao wrote: > > Using strscpy() to read the task comm ensures that the name is > > always NUL-terminated, regardless of the source string. This approach als

Re: [PATCH v6 7/9] tracing: Replace strncpy() with strscpy()

2024-08-13 Thread Justin Stitt
Hi, On Mon, Aug 12, 2024 at 10:29:31AM GMT, Yafang Shao wrote: > Using strscpy() to read the task comm ensures that the name is > always NUL-terminated, regardless of the source string. This approach also > facilitates future extensions to the task comm. Thanks for sending patches replacing str{n

Re: [PATCH] drm/panthor: Fix clang -Wunused-but-set-variable in tick_ctx_apply()

2024-03-28 Thread Justin Stitt
> > Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block") > Signed-off-by: Nathan Chancellor Reviewed-by: Justin Stitt > --- > drivers/gpu/drm/panthor/panthor_sched.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/driv

[PATCH] video/hdmi: prefer length specifier in format over string copying

2024-03-20 Thread Justin Stitt
/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Note: build-tested only. Found with: $ rg "strncpy\(" --- drivers/video/hdmi.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/video/hdmi.c b/drivers/video/hd

[PATCH] fbdev: uvesafb: replace deprecated strncpy with strscpy_pad

2024-03-20 Thread Justin Stitt
ps://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Note: b

[PATCH] video: fbdev: fsl-diu-fb: replace deprecated strncpy with strscpy_pad

2024-03-20 Thread Justin Stitt
s://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Note: build-tested only. Found with: $ rg "strncpy\(" --- drivers/video/fbdev/fsl-diu-fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/

Re: [PATCH] video: fbdev: au1200fb: replace deprecated strncpy with strscpy

2024-03-20 Thread Justin Stitt
Hi, On Wed, Mar 20, 2024 at 12:56 AM Helge Deller wrote: > > On 3/19/24 00:46, Justin Stitt wrote: > > strncpy() is deprecated for use on NUL-terminated destination strings > > [1] and as such we should prefer more robust and less ambiguous string > > interfaces. >

[PATCH] video: fbdev: au1200fb: replace deprecated strncpy with strscpy

2024-03-18 Thread Justin Stitt
rnel.org Signed-off-by: Justin Stitt --- Note: build-tested only. Found with: $ rg "strncpy\(" --- drivers/video/fbdev/au1200fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c index 6f20efc663d7..e718fea

Re: [PATCH 7/9] drm: tests: Fix invalid printf format specifiers in KUnit tests

2024-02-21 Thread Justin Stitt
s/drm_buddy: add alloc_contiguous test") > Fixes: fca7526b7d89 ("drm/tests/drm_buddy: fix build failure on 32-bit > targets") > Fixes: fc8d29e298cf ("drm: selftest: convert drm_mm selftest to KUnit") > Signed-off-by: David Gow Reviewed-by: Justin Stitt > --- >

Re: [PATCH 6/9] net: test: Fix printf format specifier in skb_segment kunit test

2024-02-21 Thread Justin Stitt
ks good. For those wondering, %pe has a special meaning in the kernel which can be seen in lib/vsprintf.c. Reviewed-by: Justin Stitt > --- > net/core/gso_test.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/core/gso_test.c b/net/core/gso_test.c >

Re: [PATCH 5/9] rtc: test: Fix invalid format specifier.

2024-02-21 Thread Justin Stitt
tc: Improve performance of rtc_time64_to_tm(). Add > tests.") > Signed-off-by: David Gow Reviewed-by: Justin Stitt > --- > drivers/rtc/lib_test.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/rtc/lib_test.c b/drivers/rtc/lib_test.c >

Re: [PATCH 4/9] time: test: Fix incorrect format specifier

2024-02-21 Thread Justin Stitt
t;time: Improve performance of time64_to_tm()") > Signed-off-by: David Gow Reviewed-by: Justin Stitt > --- > kernel/time/time_test.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/time/time_test.c b/kernel/time/time_test.c > index ca058c8af6b

Re: [PATCH 3/9] lib: memcpy_kunit: Fix an invalid format specifier in an assertion msg

2024-02-21 Thread Justin Stitt
the format strings. > > Fixes: bb95ebbe89a7 ("lib: Introduce CONFIG_MEMCPY_KUNIT_TEST") > Signed-off-by: David Gow > --- Reviewed-by: Justin Stitt > lib/memcpy_kunit.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/memcp

Re: [PATCH 2/9] lib/cmdline: Fix an invalid format specifier in an assertion msg

2024-02-21 Thread Justin Stitt
Hi, On Wed, Feb 21, 2024 at 05:27:15PM +0800, David Gow wrote: > The correct format specifier for p - n (both p and n are pointers) is > %td, as the type should be ptrdiff_t. I think %tu is better. d specifies a signed type. I don't doubt that the warning is fixed but I think %tu represents the t

Re: [PATCH 1/9] kunit: test: Log the correct filter string in executor_test

2024-02-21 Thread Justin Stitt
t gcc validate > the format string. > > Fixes: 76066f93f1df ("kunit: add tests for filtering attributes") > Signed-off-by: David Gow Reviewed-by: Justin Stitt > --- > lib/kunit/executor_test.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >

Re: [PATCH 9/9] kunit: Annotate _MSG assertion variants with gnu printf specifiers

2024-02-21 Thread Justin Stitt
er now that we've fixed these errors, to > prevent them from recurring. > > Suggested-by: Linus Torvalds > Signed-off-by: David Gow Reviewed-by: Justin Stitt > --- > include/kunit/test.h | 12 ++-- > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff

[PATCH v2] drm/modes: replace deprecated strncpy with strscpy_pad

2023-10-16 Thread Justin Stitt
char name[DRM_DISPLAY_MODE_LEN]; Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Cc: Xu Panda Signed-off-by: Justin Stitt --- Changes in v2: - use strscpy_pad (thanks Kee

[PATCH v2] drm/i915: refactor deprecated strncpy

2023-09-18 Thread Justin Stitt
cpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Changes in v2: - drop the `... - 1` (thanks Kees) - Link to v1: https://lore.kernel.org/r/20230914-strncpy-drivers-gpu-drm-i915-gem-selftests-mock_context-c-v1-1-c3f9

[PATCH v2] drm/gma500: refactor deprecated strncpy

2023-09-18 Thread Justin Stitt
k: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Changes in v2: - use sizeof() instead of I2C_NAME_SIZE (thanks Kees, Patrik) - Link to v1: https://lore.kernel.org/r/20230914-drivers-gpu-drm-gma500-oaktrail_lvds_i2c-c-v1-1-0

[PATCH v2] drm/etnaviv: refactor deprecated strncpy

2023-09-18 Thread Justin Stitt
behavior that strncpy provides. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Cc: Bo YU Signed-off-by: Justin Stitt --- Changes in v2: - use strscpy_pad

[PATCH] drm/nouveau/pm: refactor deprecated strncpy

2023-09-14 Thread Justin Stitt
. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt

[PATCH] drm/nouveau/core: refactor deprecated strncpy

2023-09-14 Thread Justin Stitt
cated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- drivers/gpu/drm/nouveau/nvkm/core/firmware.c | 3 +

[PATCH] drm/nouveau/nvif: refactor deprecated strncpy

2023-09-14 Thread Justin Stitt
b.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Note: build-tested only. --- drivers/gpu/drm/nouveau/nvif/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nvif/client.c b/drivers/gpu/drm/nouveau/nvi

[PATCH] drm/i915: refactor deprecated strncpy

2023-09-14 Thread Justin Stitt
ocess/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- drivers/gpu/drm/i915/gem/selftests/mock_context.

[PATCH] drm/gma500: refactor deprecated strncpy

2023-09-14 Thread Justin Stitt
Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- drm/gma500: refactor deprecated strncpy --- drivers/gpu/drm/gma500/oaktrail_lvds_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds_i2c.c b/drivers/gpu/drm/gma

[PATCH] drm/etnaviv: refactor deprecated strncpy

2023-09-14 Thread Justin Stitt
/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Cc: Bo YU Signed-off-by: Justin Stitt --- Similar to [1

[PATCH] drm/modes: refactor deprecated strncpy

2023-09-14 Thread Justin Stitt
arden...@vger.kernel.org Cc: Xu Panda Signed-off-by: Justin Stitt --- This patch is basically a resend of [1] by Xu but rebased onto mainline. This patch is also similar to: commit 0f9aa074c92dd ("drm/modes: Use strscpy() to copy command-line mode name") [1]: https://lore.kernel.org/all/202

Re: [PATCH] habanalabs/gaudi: refactor deprecated strncpy

2023-08-25 Thread Justin Stitt
This patch as well as two other related patches were combined into a single patch [1] On Thu, Aug 24, 2023 at 1:41 PM Justin Stitt wrote: > > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. > > A suitable replacement is `strscpy` [2] due to the

Re: [PATCH] habanalabs/gaudi2: refactor deprecated strncpy

2023-08-25 Thread Justin Stitt
This patch as well as two other related patches were combined into a single patch [1] On Thu, Aug 24, 2023 at 1:45 PM Justin Stitt wrote: > > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. > > A suitable replacement is `strscpy` [2] due to the

Re: [PATCH] habanalabs/goya: refactor deprecated strncpy

2023-08-25 Thread Justin Stitt
This patch as well as two other related patches were combined into a single patch [1] Thu, Aug 24, 2023 at 1:49 PM Justin Stitt wrote: > > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. > > A suitable replacement is `strscpy` [2] due to the fact that it

[PATCH] accel/habanalabs: refactor deprecated strncpy to strscpy_pad

2023-08-25 Thread Justin Stitt
w.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings[1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt Suggested-by: Kees Co

[PATCH] accel/ivpu: refactor deprecated strncpy

2023-08-24 Thread Justin Stitt
eprecated.html#strncpy-on-nul-terminated-strings[1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Note: build-tested only. --- drivers/accel/ivpu/ivpu_

[PATCH] habanalabs/goya: refactor deprecated strncpy

2023-08-24 Thread Justin Stitt
/deprecated.html#strncpy-on-nul-terminated-strings[1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Note: build-tested only. --- drivers/accel/habanalabs/goya

[PATCH] habanalabs/gaudi2: refactor deprecated strncpy

2023-08-24 Thread Justin Stitt
/deprecated.html#strncpy-on-nul-terminated-strings[1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Note: build-tested only. --- drivers/accel/habanalabs/gaudi2

[PATCH] habanalabs/gaudi: refactor deprecated strncpy

2023-08-24 Thread Justin Stitt
/deprecated.html#strncpy-on-nul-terminated-strings[1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Note: build-tested only --- drivers/accel/habanalabs/gaudi

[PATCH] accel/habanalabs: refactor deprecated strncpy

2023-08-22 Thread Justin Stitt
/latest/process/deprecated.html#strncpy-on-nul-terminated-strings[1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Note: build-tested only

[PATCH] drm: pl111: fix clang -Wvoid-pointer-to-enum-cast warning

2023-08-16 Thread Justin Stitt
sues/1910 Reported-by: Nathan Chancellor Signed-off-by: Justin Stitt --- drivers/gpu/drm/pl111/pl111_versatile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c index 00c3ebd32

[PATCH] drm/repaper: fix -Wvoid-pointer-to-enum-cast warning

2023-08-16 Thread Justin Stitt
repaper_model)spi_id->driver_data; Link: https://github.com/ClangBuiltLinux/linux/issues/1910 Reported-by: Nathan Chancellor Signed-off-by: Justin Stitt --- drivers/gpu/drm/tiny/repaper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers