Re: [PATCH 032/141] floppy: Fix fall-through warnings for Clang

2021-04-20 Thread Denis Efremov
Hi, Sorry, this was missed somehow. I would rewrite it to something more simple instead of adding fallthrough. What about? --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -2123,12 +2123,14 @@ static void set_floppy(int drive) static void format_interrupt(void) { switch

Re: [PATCH] floppy: remove redundant assignment to variable st

2021-04-16 Thread Denis Efremov
: > From: Colin Ian King > > The variable st is being assigned a value that is never read and > it is being updated later with a new value. The initialization is > redundant and can be removed. > > Addresses-Coverity: ("Unused value") > Signed-off-by: Colin Ian

[PATCH 4/5] floppy: cleanups: use memcpy() to copy reply_buffer

2021-04-16 Thread Denis Efremov
Use memcpy() in raw_cmd_done() to copy reply_buffer instead of a for loop. Signed-off-by: Denis Efremov --- drivers/block/floppy.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index c58b0b079afc..c584657bacab 100644

[PATCH 5/5] floppy: cleanups: remove FLOPPY_SILENT_DCL_CLEAR undef

2021-04-16 Thread Denis Efremov
FLOPPY_SILENT_DCL_CLEAR is not defined anywhere and comes from pre-git era. Just drop this undef. There is FD_SILENT_DCL_CLEAR which is really used. Signed-off-by: Denis Efremov --- drivers/block/floppy.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/block/floppy.c b/drivers

[PATCH 1/5] floppy: cleanups: remove trailing whitespaces

2021-04-16 Thread Denis Efremov
Cleanup trailing whitespaces as checkpatch.pl suggests. Signed-off-by: Denis Efremov --- include/uapi/linux/fd.h | 46 - 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/include/uapi/linux/fd.h b/include/uapi/linux/fd.h index 8b80c63b971c

[PATCH 2/5] floppy: cleanups: use ST0 as reply_buffer index 0

2021-04-16 Thread Denis Efremov
Use ST0 as 0 index for reply_buffer array. get_fdc_version() is the only function that uses index 0 directly instead of the ST0 define. Signed-off-by: Denis Efremov --- drivers/block/floppy.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/block/floppy.c

[PATCH 3/5] floppy: cleanups: use memset() to zero reply_buffer

2021-04-16 Thread Denis Efremov
Use memset() to zero reply buffer in raw_cmd_copyin() instead of a for loop. Signed-off-by: Denis Efremov --- drivers/block/floppy.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index df5c32900539..c58b0b079afc 100644

[PATCH 0/5] Another small set of cleanups for floppy driver

2021-04-16 Thread Denis Efremov
Just a couple of patches to make checkpatch.pl a bit more happy. All these patches preserve original semantics of the code and only memset(), memcpy() patches change binary code. Denis Efremov (5): floppy: cleanups: remove trailing whitespaces floppy: cleanups: use ST0 as reply_buffer index 0

Re: [PATCH] floppy: remove redundant assignment to variable st

2021-04-16 Thread Denis Efremov
Hi, On 4/15/21 4:00 PM, Colin King wrote: > From: Colin Ian King > > The variable st is being assigned a value that is never read and > it is being updated later with a new value. The initialization is > redundant and can be removed. > > Addresses-Coverity: ("Unused value") > Signed-off-by:

[PATCH] coccinelle: misc: minmax: suppress patch generation for err returns

2021-04-09 Thread Denis Efremov
of patches. Signed-off-by: Denis Efremov --- scripts/coccinelle/misc/minmax.cocci | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/scripts/coccinelle/misc/minmax.cocci b/scripts/coccinelle/misc/minmax.cocci index eccdd3eb3452..fcf908b34f27 100644 --- a/

Re: [PATCH] inotify: fix minmax.cocci warnings

2021-04-08 Thread Denis Efremov
elle/misc/minmax.cocci >>> >>> Fixes: 8636e3295ce3 ("coccinelle: misc: add minmax script") >>> CC: Denis Efremov >>> Reported-by: kernel test robot >>> Signed-off-by: kernel test robot >>> Signed-off-by: Julia Lawall

Re: [PATCH v3] coccinelle: misc: add swap script

2021-03-28 Thread Denis Efremov
Ping? On 3/5/21 1:09 PM, Denis Efremov wrote: Check for opencoded swap() implementation. Signed-off-by: Denis Efremov --- Changes in v2: - additional patch rule to drop excessive {} - fix indentation in patch mode by anchoring ; Changes in v3: - Rule added for simple (without var init

Re: [PATCH] coccinelle: misc: update uninitialized_var.cocci documentation

2021-03-24 Thread Denis Efremov
Ping? On 3/8/21 10:30 AM, Denis Efremov wrote: > Remove the documentation link from the warning message because commit > 3942ea7a10c9 ("deprecated.rst: Remove now removed uninitialized_var") > removed the section from documentation. Update the rule documentation > accord

Re: [PATCH] coccinelle: misc: restrict patch mode in flexible_array.cocci

2021-03-24 Thread Denis Efremov
Ping? On 3/8/21 10:12 PM, Denis Efremov wrote: > Skip patches generation for structs/unions with a single field. > Changing a zero-length array to a flexible array member in a struct > with no named members breaks the compilation. However, reporting > such cases is still valuable,

[PATCH v5] coccinelle: misc: add minmax script

2021-03-08 Thread Denis Efremov
Check for opencoded min(), max() implementations. Signed-off-by: Denis Efremov --- Changes in v2: - <... ...> instead of ... when any - org mode reports fixed - patch rule to drop excessive () Changes in v3: - "depends on patch && (pmax || pmaxif || pmin || pminif)&q

[PATCH] coccinelle: misc: restrict patch mode in flexible_array.cocci

2021-03-08 Thread Denis Efremov
cocci warnings"). Signed-off-by: Denis Efremov --- scripts/coccinelle/misc/flexible_array.cocci | 23 ++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/scripts/coccinelle/misc/flexible_array.cocci b/scripts/coccinelle/misc/flexible_array.cocci index 94

[PATCH] coccinelle: misc: update uninitialized_var.cocci documentation

2021-03-07 Thread Denis Efremov
Remove the documentation link from the warning message because commit 3942ea7a10c9 ("deprecated.rst: Remove now removed uninitialized_var") removed the section from documentation. Update the rule documentation accordingly. Signed-off-by: Denis Efremov --- scripts/cocci

[PATCH v4] coccinelle: misc: add minmax script

2021-03-07 Thread Denis Efremov
Check for opencoded min(), max() implementations. Signed-off-by: Denis Efremov --- Changes in v2: - <... ...> instead of ... when any - org mode reports fixed - patch rule to drop excessive () Changes in v3: - "depends on patch && (pmax || pmaxif || pmin || pminif)&q

[PATCH 1/2] perf tests: Remove duplicate bitmap test

2021-03-05 Thread Denis Efremov
test_bitmap("1,3-6,8-10,24,35-37") called twice in a row. Remove the second test. Signed-off-by: Denis Efremov --- tools/perf/tests/bitmap.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/perf/tests/bitmap.c b/tools/perf/tests/bitmap.c index 96c137360918..332061340

[PATCH 2/2] perf tests: Remove duplicate cpumap test

2021-03-05 Thread Denis Efremov
cpu_map_print("1,3-6,8-10,24,35-37") called twice in a row. Remove the second test. Signed-off-by: Denis Efremov --- tools/perf/tests/cpumap.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/perf/tests/cpumap.c b/tools/perf/tests/cpumap.c index 29c793ac7d10..f906633ea

[PATCH] sun/niu: fix wrong RXMAC_BC_FRM_CNT_COUNT count

2021-03-05 Thread Denis Efremov
RXMAC_BC_FRM_CNT_COUNT added to mp->rx_bcasts twice in a row in niu_xmac_interrupt(). Remove the second addition. Signed-off-by: Denis Efremov --- I don't know the code of the dirver, but this looks like a real bug. Otherwise, it's more readable as: mp->rx_bcasts += RXMAC_BC_FRM_CNT_COU

[PATCH] net/hamradio/6pack: remove redundant check in sp_encaps()

2021-03-05 Thread Denis Efremov
"len > sp->mtu" checked twice in a row in sp_encaps(). Remove the second check. Signed-off-by: Denis Efremov --- drivers/net/hamradio/6pack.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 71d6629e65

[PATCH] staging: rtl8723bs: remove duplicate pstat->hwaddr check

2021-03-05 Thread Denis Efremov
IS_MCAST(pstat->hwaddr) checked twice in a row in odm_RefreshRateAdaptiveMaskCE(). Remove the second check. Signed-off-by: Denis Efremov --- drivers/staging/rtl8723bs/hal/odm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm.c b/drivers/staging/rtl872

[PATCH] powerpc/ptrace: Remove duplicate check from pt_regs_check()

2021-03-05 Thread Denis Efremov
"offsetof(struct pt_regs, msr) == offsetof(struct user_pt_regs, msr)" checked in pt_regs_check() twice in a row. Remove the second check. Signed-off-by: Denis Efremov --- arch/powerpc/kernel/ptrace/ptrace.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/powerpc/kernel/ptrac

[PATCH v3] coccinelle: misc: add minmax script

2021-03-05 Thread Denis Efremov
Check for opencoded min(), max() implementations. Signed-off-by: Denis Efremov --- Changes in v2: - <... ...> instead of ... when any - org mode reports fixed - patch rule to drop excessive () Changes in v3: - "depends on patch && (pmax || pmaxif || pmin || pmini

[PATCH v3] coccinelle: misc: add swap script

2021-03-05 Thread Denis Efremov
Check for opencoded swap() implementation. Signed-off-by: Denis Efremov --- Changes in v2: - additional patch rule to drop excessive {} - fix indentation in patch mode by anchoring ; Changes in v3: - Rule added for simple (without var init) swap highlighting in !patch mode - "de

[PATCH v2] coccinelle: misc: add swap script

2021-02-19 Thread Denis Efremov
Check for opencoded swap() implementation. Signed-off-by: Denis Efremov --- Changes in v2: - additional patch rule to drop excessive {} - fix indentation in patch mode by anchoring ; scripts/coccinelle/misc/swap.cocci | 101 + 1 file changed, 101 insertions

Re: [PATCH v2] coccinelle: misc: add minmax script

2021-02-19 Thread Denis Efremov
Sorry for wrong thread, I'll resend v2 to the right one. Denis On 2/19/21 12:05 PM, Denis Efremov wrote: > Check for opencoded min(), max() implementations. > > Signed-off-by: Denis Efremov > --- > > Changes in v2: > - <... ...> instead of ... when any > - org

[PATCH v2] coccinelle: misc: add minmax script

2021-02-19 Thread Denis Efremov
Check for opencoded min(), max() implementations. Signed-off-by: Denis Efremov --- Changes in v2: - <... ...> instead of ... when any - org mode reports fixed - patch rule to drop excessive () scripts/coccinelle/misc/minmax.cocci | 224 +++ 1 file change

[PATCH v2 RESEND] coccinelle: misc: add minmax script

2021-02-19 Thread Denis Efremov
Check for opencoded min(), max() implementations. Signed-off-by: Denis Efremov --- Changes in v2: - <... ...> instead of ... when any - org mode reports fixed - patch rule to drop excessive () scripts/coccinelle/misc/minmax.cocci | 224 +++ 1 file change

Re: [PATCH] coccinelle: misc: add swap script

2021-02-18 Thread Denis Efremov
On 2/18/21 2:29 PM, Julia Lawall wrote: > > > On Thu, 18 Feb 2021, Denis Efremov wrote: > >> >> >> On 2/18/21 1:17 PM, Julia Lawall wrote: >>> >>> >>> On Thu, 18 Feb 2021, Denis Efremov wrote: >>> >>>>

Re: [PATCH] coccinelle: misc: add swap script

2021-02-18 Thread Denis Efremov
On 2/18/21 1:17 PM, Julia Lawall wrote: > > > On Thu, 18 Feb 2021, Denis Efremov wrote: > >> >> >> On 2/18/21 12:31 AM, Julia Lawall wrote: >>>> +@depends on patch@ >>>> +identifier tmp; >>>> +expression a, b; >>>

Re: [PATCH] coccinelle: misc: add swap script

2021-02-17 Thread Denis Efremov
On 2/18/21 12:31 AM, Julia Lawall wrote: >> +@depends on patch@ >> +identifier tmp; >> +expression a, b; >> +type T; >> +@@ >> + >> +( >> +- T tmp; >> +| >> +- T tmp = 0; >> +| >> +- T *tmp = NULL; >> +) >> +... when != tmp >> +- tmp = a; >> +- a = b; >> +- b = tmp; >> ++ swap(a, b); >> +...

[PATCH] coccinelle: misc: add minmax script

2021-02-16 Thread Denis Efremov
Check for opencoded min(), max() implementations. Signed-off-by: Denis Efremov --- scripts/coccinelle/misc/minmax.cocci | 198 +++ 1 file changed, 198 insertions(+) create mode 100644 scripts/coccinelle/misc/minmax.cocci diff --git a/scripts/coccinelle/misc

[PATCH] coccinelle: misc: add swap script

2021-02-16 Thread Denis Efremov
Check for opencoded swap() implementation. Signed-off-by: Denis Efremov --- scripts/coccinelle/misc/swap.cocci | 77 ++ 1 file changed, 77 insertions(+) create mode 100644 scripts/coccinelle/misc/swap.cocci diff --git a/scripts/coccinelle/misc/swap.cocci b/scripts

Re: [PATCH] floppy: reintroduce O_NDELAY fix

2021-02-04 Thread Denis Efremov
On 2/4/21 12:24 PM, Jiri Kosina wrote: > On Tue, 26 Jan 2021, Denis Efremov wrote: > >> Applied. I'll send it to Jens soon with a couple of cleanup patches. >> >> https://github.com/evdenis/linux-floppy/commit/e32f6163c47efbdbad06258560aa00d1c7e5b699 > > De

[GIT PULL] Floppy patch for 5.12

2021-02-04 Thread Denis Efremov
is using O_NONBLOCK when probing devices. This leads to pollution of kernel log with error messages from floppy driver. Also the driver fails a mount prior to being opened without O_NONBLOCK at least once. The patch fixes the issues. Signed-off-by: Denis Efremov

Re: [PATCH] floppy: reintroduce O_NDELAY fix

2021-01-26 Thread Denis Efremov
On 1/22/21 2:13 PM, Jiri Kosina wrote: > From: Jiri Kosina > > This issue was originally fixed in 09954bad4 ("floppy: refactor open() > flags handling"). > > The fix as a side-effect, however, introduce issue for open(O_ACCMODE) > that is being used for ioctl-only open. I wrote a fix for

Re: [PATCH] floppy: reintroduce O_NDELAY fix

2021-01-26 Thread Denis Efremov
On 1/26/21 12:31 PM, Kurt Garloff wrote: > Hi Denis, Jiri, Jens, > > Am 26.01.21 um 09:21 schrieb Denis Efremov: >> On 1/22/21 2:13 PM, Jiri Kosina wrote: >>> From: Jiri Kosina >>> >>> This issue was originally fixed in 09954bad4 (&q

Re: [PATCH v1] trace: Fix race in trace_open and buffer resize call

2021-01-23 Thread Denis Efremov
On 1/22/21 5:37 PM, Steven Rostedt wrote: > On Fri, 22 Jan 2021 16:55:29 +0530 > Gaurav Kohli wrote: > That could possibly work. >> >> Yes, this will work, As i have tested similar patch for internal testing >> for kernel branches like 5.4/4.19. > > Can you or Denis send a proper

Re: [PATCH v1] trace: Fix race in trace_open and buffer resize call

2021-01-21 Thread Denis Efremov
On 1/21/21 10:09 PM, Steven Rostedt wrote: > On Thu, 21 Jan 2021 17:30:40 +0300 > Denis Efremov wrote: > >> Hi, >> >> This patch (CVE-2020-27825) was tagged with >> Fixes: b23d7a5f4a07a ("ring-buffer: speed up buffer resets by avoiding >&

Re: [PATCH RESEND] floppy: fix open(O_ACCMODE) for ioctl-only open

2021-01-21 Thread Denis Efremov
On 1/21/21 5:44 PM, Jiri Kosina wrote: > On Thu, 21 Jan 2021, Jiri Kosina wrote: > >> I am currently waiting for confirmation by the original reporter that the >> patch below fixes the issue. > > ... a now a patch that actually compiles :) (made a mistake when > forward-porting from the

Re: [PATCH RESEND] floppy: fix open(O_ACCMODE) for ioctl-only open

2021-01-21 Thread Denis Efremov
On 1/21/21 1:25 PM, Jiri Kosina wrote: > On Thu, 21 Jan 2021, Denis Efremov wrote: > >> I think it's hard to recall the exact reasons after so many years. > > Yeah, I guess so :) > >> I'll send a patch today based on this one. > > I am currently waiting

Re: [PATCH v1] trace: Fix race in trace_open and buffer resize call

2021-01-21 Thread Denis Efremov
Hi, This patch (CVE-2020-27825) was tagged with Fixes: b23d7a5f4a07a ("ring-buffer: speed up buffer resets by avoiding synchronize_rcu for each CPU") I'm not an expert here but it seems like b23d7a5f4a07a only refactored ring_buffer_reset_cpu() by introducing reset_disabled_cpu_buffer() without

Re: [PATCH RESEND] floppy: fix open(O_ACCMODE) for ioctl-only open

2021-01-20 Thread Denis Efremov
Hi, On 1/19/21 6:53 PM, Jiri Kosina wrote: > On Mon, 25 Jul 2016, Jens Axboe wrote: > >>> From: Jiri Kosina >>> >>> Commit 09954bad4 ("floppy: refactor open() flags handling"), as a >>> side-effect, causes open(/dev/fdX, O_ACCMODE) to fail. It turns out that >>> this is being used setfdprm

[PATCH v8] coccinelle: api: add kfree_mismatch script

2020-10-16 Thread Denis Efremov
Check that alloc and free types of functions match each other. Signed-off-by: Denis Efremov --- Changes in v2: - Lines are limited to 80 characters where possible - Confidence changed from High to Medium because of fs/btrfs/send.c:1119 false-positive - __vmalloc_area_node() explicitly

[PATCH] coccinelle: api: kfree_sensitive: print memset position

2020-10-09 Thread Denis Efremov
Print memset() call position in addition to the kfree() position to ease issues identification. Signed-off-by: Denis Efremov --- scripts/coccinelle/api/kfree_sensitive.cocci | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/coccinelle/api

Re: kzfree script

2020-10-02 Thread Denis Efremov
On 10/2/20 5:13 PM, Julia Lawall wrote: > > > On Fri, 2 Oct 2020, Denis Efremov wrote: > >> Hi, >> >> On 10/2/20 5:01 PM, Julia Lawall wrote: >>> Denis, >>> >>> In the rule proposing kzfree_sensitive, I think it would be helpful to &

Re: kzfree script

2020-10-02 Thread Denis Efremov
Hi, On 10/2/20 5:01 PM, Julia Lawall wrote: > Denis, > > In the rule proposing kzfree_sensitive, I think it would be helpful to > also highlight the memset line. What do you mean? It's "highlighted" in context mode. Do you mean adding position argument to memset call and showing this position

[PATCH v4] coccinelle: api: add kvmalloc script

2020-09-30 Thread Denis Efremov
Suggest kvmalloc, kvfree instead of opencoded patterns. Signed-off-by: Denis Efremov --- Changes in v2: - binary operator cmp added - NULL comparisions simplified - "T x" case added to !patch mode Changes in v3: - kvfree rules added Changes in v4: - pattern updated to match only

[PATCH v3] coccinelle: misc: add flexible_array.cocci script

2020-09-21 Thread Denis Efremov
Add zero-length and one-element arrays") Cc: Kees Cook Cc: Gustavo A. R. Silva Signed-off-by: Denis Efremov --- Changes in v2: - all uapi headers are now filtered-out. Unfortunately, coccinelle doesn't provide structure names in Location.current_element. For structures the field is al

Re: [PATCH v7] coccinelle: api: add kfree_mismatch script

2020-09-21 Thread Denis Efremov
Hi, On 8/3/20 9:34 PM, Denis Efremov wrote: > Check that alloc and free types of functions match each other. Julia, I've just send the patches to fix all the warnings emitted by the script. [1] https://lore.kernel.org/patchwork/patch/1309731/ [2] https://lore.kernel.org/patchwork/patch/1309

[PATCH 1/2] btrfs: use kvzalloc() to allocate clone_roots in btrfs_ioctl_send()

2020-09-21 Thread Denis Efremov
xes: 818e010bf9d0 ("btrfs: replace opencoded kvzalloc with the helper") Signed-off-by: Denis Efremov --- fs/btrfs/send.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index d9813a5b075a..c874ddda6252 100644 --- a/fs/btrfs/send.c +

[PATCH 2/2] btrfs: check allocation size in btrfs_ioctl_send()

2020-09-21 Thread Denis Efremov
Replace kvzalloc() call with kvcalloc() that checks the size internally. Use array_size() helper to compute the memory size for clone_sources_tmp. Cc: Kees Cook Signed-off-by: Denis Efremov --- fs/btrfs/send.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fs

[PATCH 2/2] net/mlx5e: Use kfree() to free fd->g in accel_fs_tcp_create_groups()

2020-09-21 Thread Denis Efremov
Memory ft->g in accel_fs_tcp_create_groups() is allocaed with kcalloc(). It's excessive to free ft->g with kvfree(). Use kfree() instead. Signed-off-by: Denis Efremov --- drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH 1/2] net/mlx5e: IPsec: Use kvfree() for memory allocated with kvzalloc()

2020-09-21 Thread Denis Efremov
Variables flow_group_in, spec in rx_fs_create() are allocated with kvzalloc(). It's incorrect to free them with kfree(). Use kvfree() instead. Fixes: 5e466345291a ("net/mlx5e: IPsec: Add IPsec steering in local NIC RX") Signed-off-by: Denis Efremov --- drivers/net/ethernet/mellanox

[PATCH v2] coccinelle: misc: add excluded_middle.cocci script

2020-09-21 Thread Denis Efremov
Check for !A || A && B condition. It's equivalent to !A || B. Signed-off-by: Denis Efremov --- Changes in v2: - spelling mistake fixed - position variable moved on the && operator - patch pattern changed to - (A && B) - word "condition" removed from warning

Re: [PATCH v2] coccinelle: misc: add flexible_array.cocci script

2020-09-13 Thread Denis Efremov
Hi, On 9/12/20 5:43 PM, Julia Lawall wrote: > > > On Mon, 10 Aug 2020, Denis Efremov wrote: > >> Commit 68e4cd17e218 ("docs: deprecated.rst: Add zero-length and one-element >> arrays") marks one-element and zero-length arrays as deprecated. Kernel >>

Re: [PATCH] security: keys: Use kvfree_sensitive in a few places

2020-09-11 Thread Denis Efremov
Hi, same patch https://lkml.org/lkml/2020/8/27/168 Thanks, Denis On 9/11/20 2:44 PM, Alex Dewar wrote: > In big_key.c, there are a few places where memzero_explicit + kvfree is > used. It is better to use kvfree_sensitive instead, which is more > readable and also prevents the compiler from

Re: [PATCH] scripts: kzfree.cocci: Deprecate use of kzfree

2020-09-11 Thread Denis Efremov
mset or memzero_explicit followed > by > +/// k{,v}free > /// > // Confidence: High > // Copyright: (C) 2020 Denis Efremov ISPRAS > // Options: --no-includes --include-headers > // > -// Keywords: kzfree, kvfree_sensitive > +// Keywords: kfree_sensitive, kvfree_sensitive

[PATCH 1/2] ARM: makefile: Drop GZFLAGS definition and export

2020-09-04 Thread Denis Efremov
Drop the definition and export of GZFLAGS, because it's not used. GZFLAGS was dropped from arm64 in commit 4cf234943dcf ("arm64: drop GZFLAGS definition and export"). Signed-off-by: Denis Efremov --- arch/arm/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --

[PATCH 2/2] csky: Drop GZFLAGS definition

2020-09-04 Thread Denis Efremov
Drop the definition of GZFLAGS because it's not used. Signed-off-by: Denis Efremov --- arch/csky/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/csky/Makefile b/arch/csky/Makefile index 37f593a4bf53..715b839bf998 100644 --- a/arch/csky/Makefile +++ b/arch/csky/Makefile @@ -1,6

[PATCH 0/2] drop GZFLAGS definition

2020-09-04 Thread Denis Efremov
GZFLAGS is not used. KGZIP env var can be used to pass additional flags to gzip instead. Denis Efremov (2): ARM: makefile: Drop GZFLAGS definition and export csky: Drop GZFLAGS definition arch/arm/Makefile | 3 +-- arch/csky/Makefile | 1 - 2 files changed, 1 insertion(+), 3 deletions

Re: [PATCH 14/19] floppy: use a separate gendisk for each media format

2020-09-04 Thread Denis Efremov
ad to interesting issues in code not > aware of that fact. > > To fix this just create a separate gendisk for each of the aliases > if they are accessed. > > Signed-off-by: Christoph Hellwig Tested-by: Denis Efremov The patch looks ok as it is. Two nitpicks below if you will s

Re: [PATCH v2 1/4] crypto: inside-secure - use kfree_sensitive()

2020-09-04 Thread Denis Efremov
Hi, On 9/2/20 4:10 PM, Van Leeuwen, Pascal wrote: >> -Original Message- >> From: linux-crypto-ow...@vger.kernel.org >> On Behalf Of Denis Efremov >> Sent: Thursday, August 27, 2020 8:44 AM >> To: linux-cry...@vger.kernel.org >> Cc: Denis Efrem

[PATCH] coccinelle: misc: add excluded_middle.cocci script

2020-09-02 Thread Denis Efremov
Check for "!A || A && B" condition. It's equivalent to "!A || B" condition. Signed-off-by: Denis Efremov --- scripts/coccinelle/misc/excluded_middle.cocci | 40 +++ 1 file changed, 40 insertions(+) create mode 100644 scripts/coccinelle/misc/exclu

[PATCH] net: bcmgenet: fix mask check in bcmgenet_validate_flow()

2020-09-02 Thread Denis Efremov
VALIDATE_MASK(eth_mask->h_source) is checked twice in a row in bcmgenet_validate_flow(). Add VALIDATE_MASK(eth_mask->h_dest) instead. Fixes: 3e370952287c ("net: bcmgenet: add support for ethtool rxnfc flows") Cc: sta...@vger.kernel.org Signed-off-by: Denis Efremov --- I'm not

Re: checkpatch? (was: Re: [PATCH v3] coccinelle: misc: add uninitialized_var.cocci script)

2020-09-01 Thread Denis Efremov
On 9/1/20 5:37 PM, Joe Perches wrote: > On Tue, 2020-09-01 at 12:48 +0300, Denis Efremov wrote: >> uninitialized_var() macro was removed from the sources [1] and >> other warning-silencing tricks were deprecated [2]. The purpose of this >> cocci script is to pr

[PATCH] coccinelle: ifnullfree: add vfree(), kvfree*() functions

2020-09-01 Thread Denis Efremov
Extend the list of free functions with kvfree(), kvfree_sensitive(), vfree(). Signed-off-by: Denis Efremov --- scripts/coccinelle/free/ifnullfree.cocci | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/coccinelle/free/ifnullfree.cocci b/scripts/coccinelle

[PATCH v3] coccinelle: misc: add uninitialized_var.cocci script

2020-09-01 Thread Denis Efremov
") [2] commit 4b19bec97c88 ("docs: deprecated.rst: Add uninitialized_var()") Cc: Kees Cook Cc: Gustavo A. R. Silva Signed-off-by: Denis Efremov --- Changes in v2: - Documentation cited in the script's description - kernel.org link added to the diagnostics messages - "T

[PATCH] coccinelle: api: kobj_to_dev: don't warn about kobj_to_dev()

2020-09-01 Thread Denis Efremov
Exclude kobj_to_dev() definition from warnings. Signed-off-by: Denis Efremov --- No changes in performance. This patch can be squashed to the original patch with kobj_to_dev.cocci script. scripts/coccinelle/api/kobj_to_dev.cocci | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions

[PATCH v2] coccinelle: misc: add uninitialized_var.cocci script

2020-09-01 Thread Denis Efremov
itialized_var(). Cc: Kees Cook Cc: Gustavo A. R. Silva Signed-off-by: Denis Efremov --- Changes in v2: - Documentation cited in the script's description - kernel.org link added to the diagnostics messages - "T *var = " pattern removed - "var =@p var", "var =@p *(

[PATCH] kconfig: remove redundant assignment prompt = prompt

2020-08-31 Thread Denis Efremov
Semi-automatic removing of localization macros changed the line from "prompt = _(prompt);" to "prompt = prompt;". Drop the reduntand assignment. Fixes: 694c49a7c01c ("kconfig: drop localization support") Signed-off-by: Denis Efremov --- scripts/kconfig/nconf.c | 1

Re: [PATCH V2] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-08-30 Thread Denis Efremov
On 8/30/20 3:43 AM, Joe Perches wrote: > $ cat sysfs_emit.cocci > @@ > identifier d_show =~ "^.*show.*$"; I think this additional pattern will allow to take more functions into the scope. @da@ identifier show, store; expression name, mode; @@ ( DEVICE_ATTR(name, mode, show, store) |

[PATCH] docs: filesystems: replace to_dev() with kobj_to_dev()

2020-08-30 Thread Denis Efremov
Commit a4232963757e ("driver-core: Move kobj_to_dev from genhd.h to device.h") introduced kobj_to_dev() function. Signed-off-by: Denis Efremov --- Documentation/filesystems/sysfs.rst| 3 +-- Documentation/translations/zh_CN/filesystems/sysfs.txt | 3 +-- 2 files

[PATCH] Documentation: remove current_security() reference

2020-08-30 Thread Denis Efremov
Commit 15322a0d90b6 ("lsm: remove current_security()") removed current_security() from the sources. Signed-off-by: Denis Efremov --- Documentation/security/credentials.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/Documentation/security/credentials.rst b/Documentatio

Re: [PATCH] sysfs: Add sysfs_emit to replace sprintf to PAGE_SIZE buffers.

2020-08-29 Thread Denis Efremov
> > Anyway, this will need updating, likely with better examples. > > diff --git a/Documentation/filesystems/sysfs.rst > b/Documentation/filesystems/sysfs.rst > index ab0f7795792b..13c7a86fa6c8 100644 > --- a/Documentation/filesystems/sysfs.rst > +++ b/Documentation/filesystems/sysfs.rst > @@

Re: sysfs output without newlines

2020-08-29 Thread Denis Efremov
Hi, On 8/29/20 9:23 PM, Joe Perches wrote: > While doing an investigation for a possible treewide conversion of > sysfs output using sprintf/snprintf/scnprintf, I discovered > several instances of sysfs output without terminating newlines. > > It seems likely all of these should have newline

Re: [RFC PATCH] coccinelle: misc: add uninitialized_var.cocci script

2020-08-29 Thread Denis Efremov
On 8/29/20 10:48 PM, Julia Lawall wrote: > > > On Sat, 29 Aug 2020, Joe Perches wrote: > >> On Sat, 2020-08-29 at 21:36 +0200, Julia Lawall wrote: >>> >>> On Wed, 12 Aug 2020, Denis Efremov wrote: >>> >>>> Commit 63a0895d960a (&quo

Re: [PATCH] sysfs: Add sysfs_emit to replace sprintf to PAGE_SIZE buffers.

2020-08-29 Thread Denis Efremov
Hi, On 8/29/20 1:52 AM, Joe Perches wrote: > sprintf does not know the PAGE_SIZE maximum of the temporary buffer > used for outputting sysfs content requests and it's possible to > overrun the buffer length. > > Add a generic sysfs_emit mechanism that knows that the size of the > temporary

[RFC PATCH] coccinelle: api: add flex_array_size.cocci script

2020-08-28 Thread Denis Efremov
A. R. Silva Cc: Kees Cook Signed-off-by: Denis Efremov --- Kees, Gustavo, may I have your acks if you find this script useful? Currently, it emits following warnings: ./fs/select.c:994:25-26: WARNING opportunity for flex_array_size ./include/linux/avf/virtchnl.h:711:34-35: WARNING opportunity

Re: [Cocci] [PATCH] usb: atm: don't use snprintf() for sysfs attrs

2020-08-27 Thread Denis Efremov
> > I tried: > @@ > identifier f_show =~ "^.*_show$"; This will miss this kind of functions: ./drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c:1953:static DEVICE_ATTR(vbios_version, 0444, amdgpu_atombios_get_vbios_version, ./drivers/gpu/drm/amd/amdgpu/df_v3_6.c:266:static

[PATCH v3] udf: Use kvzalloc() in udf_sb_alloc_bitmap()

2020-08-27 Thread Denis Efremov
Use kvzalloc() in udf_sb_alloc_bitmap() instead of open-coding it. Size computation wrapped in struct_size() macro to prevent potential integer overflows. Signed-off-by: Denis Efremov --- Changes in v2: - size computation wrapped in struct_size() Changes in v3: - int size dropped fs/udf

Re: [PATCH v2] udf: Use kvzalloc() in udf_sb_alloc_bitmap()

2020-08-27 Thread Denis Efremov
On 8/28/20 1:09 AM, Gustavo A. R. Silva wrote: > > > On 8/27/20 16:25, Denis Efremov wrote: >> Use kvzalloc() in udf_sb_alloc_bitmap() instead of open-coding it. >> Size computation wrapped in struct_size() macro to prevent potential >> integer overflows. >>

[PATCH] char: mspec: Use kvzalloc() in mspec_mmap()

2020-08-27 Thread Denis Efremov
Use kvzalloc() in mspec_mmap() instead of open-coding it. Signed-off-by: Denis Efremov --- drivers/char/mspec.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/char/mspec.c b/drivers/char/mspec.c index 0fae33319d2e..f8231e2e84be 100644 --- a/drivers/char/mspec.c

[PATCH v2] udf: Use kvzalloc() in udf_sb_alloc_bitmap()

2020-08-27 Thread Denis Efremov
Use kvzalloc() in udf_sb_alloc_bitmap() instead of open-coding it. Size computation wrapped in struct_size() macro to prevent potential integer overflows. Signed-off-by: Denis Efremov --- fs/udf/super.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/fs/udf/super.c

Re: [Cocci] [PATCH] usb: atm: don't use snprintf() for sysfs attrs

2020-08-27 Thread Denis Efremov
Hi all, On 8/27/20 10:42 PM, Julia Lawall wrote: > > > On Thu, 27 Aug 2020, Joe Perches wrote: > >> On Thu, 2020-08-27 at 15:48 +0100, Alex Dewar wrote: >>> On Thu, Aug 27, 2020 at 03:41:06PM +0200, Rasmus Villemoes wrote: On 27/08/2020 15.18, Alex Dewar wrote: > On Thu, Aug 27, 2020

[PATCH v2] ARM/dma-mapping: use kvzalloc() in __iommu_alloc_buffer()

2020-08-27 Thread Denis Efremov
Use kvzalloc() in __iommu_alloc_buffer() instead of open-coding it. Size computation wrapped in array_size() macro to prevent potential integer overflows. Signed-off-by: Denis Efremov --- Changes in v2: - array_size() added arch/arm/mm/dma-mapping.c | 6 +- 1 file changed, 1 insertion

Re: [PATCH] udf: Use kvzalloc() in udf_sb_alloc_bitmap()

2020-08-27 Thread Denis Efremov
> @@ -1013,10 +1013,7 @@ static struct udf_bitmap *udf_sb_alloc_bitmap(struct > super_block *sb, u32 index) > size = sizeof(struct udf_bitmap) + > (sizeof(struct buffer_head *) * nr_groups); I missed that this size is a good place to use struct_size for overflow checking. I

[PATCH] udf: Use kvzalloc() in udf_sb_alloc_bitmap()

2020-08-27 Thread Denis Efremov
Use kvzalloc() in udf_sb_alloc_bitmap() instead of open-coding it. Signed-off-by: Denis Efremov --- I'm not sure about TODO comment, through. fs/udf/super.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/udf/super.c b/fs/udf/super.c index 1c42f544096d..c7cd15219b7c

[PATCH] ARM/dma-mapping: use kvzalloc() in __iommu_alloc_buffer()

2020-08-27 Thread Denis Efremov
Use kvzalloc() in __iommu_alloc_buffer() instead of open-coding it. Signed-off-by: Denis Efremov --- arch/arm/mm/dma-mapping.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 8a8949174b1c..9def10affa70 100644

Re: [PATCH v2] scsi: libcxgbi: use kvzalloc instead of opencoded kzalloc/vzalloc

2020-08-27 Thread Denis Efremov
Ping? On 8/1/20 4:31 PM, Denis Efremov wrote: > Remove cxgbi_alloc_big_mem(), cxgbi_free_big_mem() functions > and use kvzalloc/kvfree instead. __GFP_NOWARN added to kvzalloc() > call because we already print a warning in case of allocation fail. > > Signed-off-by

[PATCH v2] crypto: sun8i-ss - remove redundant memzero_explicit()

2020-08-27 Thread Denis Efremov
Remove redundant memzero_explicit() in sun8i_ss_cipher() before calling kfree_sensitive(). kfree_sensitive() will zero the memory with memzero_explicit(). Fixes: 453431a54934 ("mm, treewide: rename kzfree() to kfree_sensitive()") Signed-off-by: Denis Efremov --- Changes in v2: - fixes

Re: [PATCH] crypto: sun8i-ss - remove redundant memzero_explicit()

2020-08-27 Thread Denis Efremov
On 8/27/20 11:03 AM, Corentin Labbe wrote: > Could you add: > Fixes: 453431a54934 ("mm, treewide: rename kzfree() to kfree_sensitive()") I doubt this change deserves fixes tag, since this is just a cleanup. Anyway, I will send v2 with it. Thanks, Denis

[PATCH] crypto: sun8i-ss - remove redundant memzero_explicit()

2020-08-27 Thread Denis Efremov
Remove redundant memzero_explicit() in sun8i_ss_cipher() before calling kfree_sensitive(). kfree_sensitive() will zero the memory with memzero_explicit(). Signed-off-by: Denis Efremov --- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 1 - 1 file changed, 1 deletion(-) diff --git

[PATCH] security/keys: use kvfree_sensitive()

2020-08-27 Thread Denis Efremov
Use kvfree_sensitive() instead of open-coding it. Signed-off-by: Denis Efremov --- security/keys/big_key.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/security/keys/big_key.c b/security/keys/big_key.c index 691347dea3c1..d17e5f09eeb8 100644 --- a/security/keys

[PATCH v2 4/4] crypto: sun8i-ss - use kfree_sensitive()

2020-08-27 Thread Denis Efremov
Use kfree_sensitive() instead of open-coding it. Signed-off-by: Denis Efremov --- .../crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c b/drivers/crypto

[PATCH v2 0/4] crypto: use kfree_sensitive()

2020-08-27 Thread Denis Efremov
kfree_sensitive() is introduced in commit 453431a54934 ("mm, treewide: rename kzfree() to kfree_sensitive()") and uses memzero_explicit() internally. Thus, we can switch to this API instead of open-coding memzero_explicit() && kfree(). Changes in v2: - if (op->len) check r

[PATCH v2 3/4] crypto: sun8i-ce - use kfree_sensitive()

2020-08-27 Thread Denis Efremov
Use kfree_sensitive() instead of open-coding it. Signed-off-by: Denis Efremov --- .../crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c b/drivers/crypto

[PATCH v2 2/4] crypto: amlogic - use kfree_sensitive()

2020-08-27 Thread Denis Efremov
Use kfree_sensitive() instead of open-coding it. Signed-off-by: Denis Efremov --- drivers/crypto/amlogic/amlogic-gxl-cipher.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/amlogic/amlogic-gxl-cipher.c b/drivers/crypto/amlogic/amlogic-gxl-cipher.c

  1   2   3   4   5   6   >