Use 2-factor multiplication argument form kcalloc() instead
of kzalloc().
Link: https://github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer
---
drivers/base/power/qos.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/power/qos.c b/drivers/base/power
Use 2-factor multiplication argument form devm_kcalloc() instead
of devm_kzalloc().
Link: https://github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer
---
sound/soc/ti/j721e-evm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/ti/j721e-evm.c b/sound
Use 2-factor multiplication argument form devm_kcalloc() instead
of devm_kzalloc().
Link: https://github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer
---
sound/soc/qcom/common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom
Use 2-factor multiplication argument form devm_kcalloc() instead
of devm_kzalloc().
Link: https://github.com/KSPP/linux/issues/162
Reviewed-by: Gustavo A. R. Silva
Acked-by: Peter Ujfalusi
Signed-off-by: Erick Archer
---
Changes in v2:
- Fix the commit title adding "j721e-evm"
---
Use 2-factor multiplication argument form kcalloc() instead
of kzalloc().
Link: https://github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer
---
drivers/scsi/csiostor/csio_init.c | 15 +--
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/csiostor
Signed-off-by: Erick Archer
---
Changes in v2:
- Update the changelog text describing the sizeof()
changes (Gustavo A. R. Silva)
Version 1:
Link:
https://lore.kernel.org/linux-hardening/20240112182603.11048-1-erick.arc...@gmx.com/
---
drivers/scsi/csiostor/csio_init.c | 15 +--
1 file
Use 2-factor multiplication argument form kcalloc() instead
of kzalloc().
Link: https://github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer
---
fs/tracefs/event_inode.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/tracefs/event_inode.c b/fs/tracefs
[1]
https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
Link: https://github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer
---
Changes in v2:
- Update the commit message to better explain the changes (Mark Rutland)
Previous versions:
[1]
https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
Link: https://github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer
---
arch/x86/events/amd/uncore.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/
github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer
---
drivers/net/wireless/intel/iwlegacy/common.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlegacy/common.c
b/drivers/net/wireless/intel/iwlegacy/common.c
index 17570d62c896..9d
github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer
---
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 1f
ion.
Link:
https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer
---
drivers/pinctrl/pinctrl-zynqmp.c | 8
1 file changed, 4 insertions(+), 4 deletions(-)
he kzalloc() function.
Link:
https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer
---
Documentation/power/opp.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
di
nk:
https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer
---
arch/mips/alchemy/common/clock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a
github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer
---
arch/riscv/kernel/cpufeature.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
index 89920f84d0a3..549a76e34c4e 100644
--- a/arch/riscv/kernel/cp
nk:
https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer
---
drivers/bus/mhi/ep/main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drive
On Sat, Jan 20, 2024 at 01:05:27PM +0100, Erick Archer wrote:
> As noted in the "Deprecated Interfaces, Language Features, Attributes,
> and Conventions" documentation [1], size calculations (especially
> multiplication) should not be performed in memory allocator (or similar)
&
ion.
Link:
https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer
---
drivers/clk/hisilicon/clk-hi3559a.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
di
Hi Dan,
On Mon, Jan 22, 2024 at 09:55:11AM +0300, Dan Carpenter wrote:
> On Fri, Jan 19, 2024 at 06:39:00PM +0100, Erick Archer wrote:
> > As noted in the "Deprecated Interfaces, Language Features, Attributes,
> > and Conventions" documentation [1], size
Hi Dan,
On Mon, Jan 22, 2024 at 10:15:20AM +0300, Dan Carpenter wrote:
> This code does not have an integer overflow, but it might have a
> different memory corruption bug.
I don't see this possible memory corruption bug. More info below.
> On Sat, Jan 20, 2024 at 04:25:18PM +0100
eadability. This patch has no effect on runtime behavior.
Link: https://github.com/KSPP/linux/issues/162 [1]
Link:
https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Reviewed-by: Gustavo A. R. Silva
Signed-off-by: Erick Archer
---
Changes i
el.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Signed-off-by: Erick Archer
---
drivers/dma/amba-pl08x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index eea8bd33b4b7..e4076
Hi Dan,
On Mon, Jan 29, 2024 at 08:20:26AM +0300, Dan Carpenter wrote:
> On Sun, Jan 28, 2024 at 11:29:33AM +0100, Erick Archer wrote:
> > > It's a bit concerning that ->event_rings is set multiple times, but only
> > > allocated one time. It's either u
ated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/162 [2]
Signed-off-by: Erick Archer
---
drivers/irqchip/irq-bcm6345-l1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-bcm6345-l1.c b/drivers/irqchip/ir
/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/162 [2]
Signed-off-by: Erick Archer
---
drivers/irqchip/irq-bcm7038-l1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-bc
el.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer
---
drivers/mtd/nand/raw/mtk_nand.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/raw/mtk
el.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Reviewed-by: Gustavo A. R. Silva
Signed-off-by: Erick Archer
---
Changes in v2:
- Add the "Reviewed-by:" tag.
- Fix a spelling error in the commit m
o get the size of these structures. Therefore, the trailing
flexible arrays can also be removed.
Link: https://github.com/KSPP/linux/issues/202 [1]
Signed-off-by: Erick Archer
---
Hi everyone,
This patch has not been tested. This has only been built-tested.
Regards,
Erick
---
drivers/infiniband/cor
nux/issues/162 [1]
Link:
https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[2]
Signed-off-by: Erick Archer
---
drivers/iommu/intel/perf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/intel/perf.c b/dri
-allocator-arguments
[2]
Signed-off-by: Erick Archer
---
drivers/iommu/mtk_iommu.c| 2 +-
drivers/iommu/mtk_iommu_v1.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 7abe9e85a570..9aae6eb604b1 100644
has also
changed (this struct contains the struct ib_flow_ipv6_filter). This is
also not a problem since it is only used to set the size of the "union
ib_flow_spec", which can store all the "ib_flow_spec_*" structures.
Link: https://github.com/KSPP/linux/issues/202 [1]
Signed-off
} __packed;
struct audio_apbridgea_*_request {
struct audio_apbridgea_hdr hdr;
...
} __packed;
In this case, the trailing flexible array can be removed because it is
never used.
Link: https://github.com/KSPP/linux/issues/202 [1]
Signed-off-by: Erick Archer
---
Hi everyone,
I'm not s
t/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer
---
drivers/net/wwan/t7xx/t7xx_port_proxy.c | 6 --
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wwan/t7xx/t7
tructures and change some variable names and types to achieve the
desired goal.
Link: https://github.com/KSPP/linux/issues/202 [1]
Signed-off-by: Erick Archer
---
Hi everyone,
This patch is based on my understanding of the code. Any comments would
be greatly appreciated.
Also, I have veri
Hi Gustavo,
On Sat, Mar 16, 2024 at 12:59:11PM -0600, Gustavo A. R. Silva wrote:
>
> [..]
>
> >
> > Link: https://github.com/KSPP/linux/issues/202 [1]
> > Signed-off-by: Erick Archer
> > ---
> > Hi everyone,
> >
> > This patch is based on my u
el.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer
---
arch/x86/events/rapl.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/x86/events/rapl.c
was detected with the help of Coccinelle, and audited and
modified manually.
Link:
https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer
---
Hi,
The Coccinelle s
el.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Reviewed-by: Gustavo A. R. Silva
Signed-off-by: Erick Archer
---
Changes in v2:
- Add the "Reviewed-by:" tag.
- Rebase against linux-next.
Previous versions:
v1 ->
https://lore.kernel.org/linu
[1]
https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
Link: https://github.com/KSPP/linux/issues/162
Reviewed-by: Gustavo A. R. Silva
Signed-off-by: Erick Archer
---
Changes in v2:
- Add the "Reviewed-by:" tag.
- Rebase against l
Reviewed-by: Gustavo A. R. Silva
Signed-off-by: Erick Archer
---
Changes in v2:
- Update the changelog text describing the sizeof()
changes (Gustavo A. R. Silva)
Changes in v3:
- Add the "Reviewed-by:" tag.
- Rebase against linux-next.
Version 1:
Link:
https://lore.kernel.org/linux
elle, and audited and
modified manually.
Link:
https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer
---
Hi,
The Coccinelle script used to detect this code patt
Hi Ingo,
On Sat, Mar 30, 2024 at 10:11:23PM +0100, Ingo Molnar wrote:
>
> * Erick Archer wrote:
>
> > As noted in the "Deprecated Interfaces, Language Features, Attributes,
> > and Conventions" documentation [1], size calculations (especially
> > multi
rray_size" helper to compute
the size of these trailing elements in the "memcpy" function.
Link:
https://www.kernel.org/doc/html/next/process/deprecated.html#zero-length-and-one-element-arrays
[1]
Link:
https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic
Hi Gustavo,
On Sun, Mar 31, 2024 at 08:53:07PM -0600, Gustavo A. R. Silva wrote:
>
>
> On 31/03/24 09:04, Erick Archer wrote:
> > The "struct mana_cfg_rx_steer_req_v2" uses a dynamically sized set of
> > trailing elements. Specifically, it uses a "mana_handle
ited and
modified manually.
Link:
https://www.kernel.org/doc/html/next/process/deprecated.html#zero-length-and-one-element-arrays
[1]
Link:
https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[2]
Signed-off-by: Erick Archer
---
Changes in v2:
msg = "WARNING: verify allocation on line %s" % (p1[0].line)
coccilib.report.print_report(p1[0],msg)
Link:
https://www.kernel.org/doc/html/next/process/deprecated.html#zero-length-and-one-element-arrays
[1]
Link:
https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-a
cated.html#zero-length-and-one-element-arrays
[1]
Link:
https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[2]
Signed-off-by: Erick Archer
---
include/net/mana/mana.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/net/mana/mana.h b
re readable and safer.
This code was detected with the help of Coccinelle, and audited and
modified manually.
Link:
https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Signed-off
l.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer
---
drivers/net/ethernet/microsoft/mana/mana_en.c | 14 ++
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a
Hi Vinod,
On Sun, Apr 07, 2024 at 05:09:39PM +0530, Vinod Koul wrote:
> On 30-03-24, 16:23, Erick Archer wrote:
> > This is an effort to get rid of all multiplications from allocation
> > functions in order to prevent integer overflows [1].
> >
> > Here the multi
On Sat, Mar 30, 2024 at 03:32:59PM +0100, Erick Archer wrote:
> This is an effort to get rid of all multiplications from allocation
> functions in order to prevent integer overflows [1][2].
>
> As the "box" variable is a pointer to "struct intel_uncore_box" and
>
On Sat, Mar 30, 2024 at 05:17:53PM +0100, Erick Archer wrote:
> Use 2-factor multiplication argument form kcalloc() instead
> of kzalloc().
>
> Also, it is preferred to use sizeof(*pointer) instead of
> sizeof(type) due to the type of the variable can change and
> one needs not
https://github.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer
---
Hi,
The Coccinelle script used to detect this code pattern is the following:
virtual report
@rule1@
type t1;
type t2;
identifier i0;
identifier i1;
identifier i2;
identifier ALLOC =~
"kmalloc|kzalloc|kmalloc_node|kz
: https://github.com/KSPP/linux/issues/162 [1]
Link:
https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[2]
Reviewed-by: Gustavo A. R. Silva
Signed-off-by: Erick Archer
---
Changes in v3:
- Update the commit message to better explain the changes
ce.
This way, the code is more readable and safer.
This code was detected with the help of Coccinelle, and audited and
modified manually.
Link:
https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/is
hub.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer
---
Hi,
The Coccinelle script used to detect this code pattern is the following:
virtual report
@rule1@
type t1;
type t2;
identifier i0;
identifier i1;
identifier i2;
identifier ALLOC =~
"kmalloc|kzalloc|kmalloc_node|k
udited and
modified manually.
Link:
https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer
---
Hi,
The Coccinelle script used to detect this code pattern
Hi Kees and Xin,
On Mon, Apr 29, 2024 at 10:45:20AM -0700, Kees Cook wrote:
> On Sat, Apr 27, 2024 at 07:23:36PM +0200, Erick Archer wrote:
> > This is an effort to get rid of all multiplications from allocation
> > functions in order to prevent integer overflows [1][2].
>
).
Suggested-by: Kees Cook
Signed-off-by: Erick Archer
---
include/uapi/linux/sctp.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h
index b7d91d4cf0db..836173e73401 100644
--- a/include/uapi/linux/sctp.h
+++ b/include/uapi
On Tue, Apr 30, 2024 at 11:15:04AM +0200, Peter Zijlstra wrote:
> On Mon, Apr 29, 2024 at 07:40:58PM +0200, Erick Archer wrote:
> > This is an effort to get rid of all multiplications from allocation
> > functions in order to prevent integer overflows [1][2].
>
> S
On Mon, Apr 29, 2024 at 07:40:58PM +0200, Erick Archer wrote:
> > > > > This is an effort to get rid of all multiplications from allocation
> > > > > functions in order to prevent integer overflows [1][2].
> > > >
> > > > So personally I detest
with the help of Coccinelle, and audited and
modified manually.
Link:
https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer
---
Changes in v2:
- Annotate &quo
On Sun, May 05, 2024 at 05:24:55PM +0200, Christophe JAILLET wrote:
> Le 05/05/2024 à 16:15, Erick Archer a écrit :
> > diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
> > index 4013408ce012..080537eff69f 100644
> > --- a/kernel/events/ring_buffer.c
&g
Provide UAPI macros for UAPI structs that will gain annotations for
__counted_by_{le, be} attributes.
Signed-off-by: Erick Archer
---
include/uapi/linux/stddef.h | 8
1 file changed, 8 insertions(+)
diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h
index
.
Link:
https://lore.kernel.org/r/20240327142241.1745989-2-aleksander.loba...@intel.com
Suggested-by: Sven Eckelmann
Signed-off-by: Erick Archer
---
Changes in v2:
- Add the "Suggested_by:" tag.
- Update the commit message to better explain the goal (Miguel Ojeda).
Previous versions:
v1 -&
Hi Kees and Christophe,
First of all, thanks for the reviews, comments and advices.
On Mon, May 06, 2024 at 09:23:15AM -0700, Kees Cook wrote:
> On Sun, May 05, 2024 at 07:31:24PM +0200, Erick Archer wrote:
> > On Sun, May 05, 2024 at 05:24:55PM +0200, Christophe JAILLET wrote:
>
Hi Alexander,
On Tue, May 07, 2024 at 02:58:15PM +0200, Alexander Lobakin wrote:
> From: Erick Archer
> Date: Mon, 6 May 2024 19:42:08 +0200
>
> > Provide UAPI macros for UAPI structs that will gain annotations for
> > __counted_by_{le, be} attributes.
>
> Pls
Hi Martin, Kees and Finn,
On Sat, Mar 30, 2024 at 05:17:53PM +0100, Erick Archer wrote:
> Use 2-factor multiplication argument form kcalloc() instead
> of kzalloc().
>
> Also, it is preferred to use sizeof(*pointer) instead of
> sizeof(type) due to the type of the variable can c
d after the
"nr_pages" assignment.
This way, the code is more safer.
This code was detected with the help of Coccinelle, and audited and
modified manually.
Link:
https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: h
Hi everyone,
On Sat, Mar 30, 2024 at 03:32:59PM +0100, Erick Archer wrote:
> This is an effort to get rid of all multiplications from allocation
> functions in order to prevent integer overflows [1][2].
>
> As the "box" variable is a pointer to "struct intel_uncore_box
ux/issues/160 [2]
Suggested-by: Christophe JAILLET
Signed-off-by: Erick Archer
---
Hi,
This patch can be considered v4 of this other one [1]. However, since
the patch has completely changed due to the addition of the flex array,
I have decided to make a new series and remove the "Reviewed-by:&q
Hi James,
On Sat, May 11, 2024 at 01:18:46PM +0200, Erick Archer wrote:
> Hi Martin, Kees and Finn,
>
> On Sat, Mar 30, 2024 at 05:17:53PM +0100, Erick Archer wrote:
> > Use 2-factor multiplication argument form kcalloc() instead
> > of kzalloc().
> >
> > Al
arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer
---
Changes in v2:
- Add the __counted_by() attribute (Kees Cook).
- Refactor the list_for_each_entry() loop to use di[n] instead of
(di + n) (Kees Cook).
Previous versio
l#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer
---
include/net/bluetooth/hci_sock.h | 2 +-
net/bluetooth/hci_core.c | 15 ++-
2 files changed, 7 insertions(+), 10 deletions(-)
diff --gi
oded-arithmetic-in-allocator-arguments
[2]
Signed-off-by: Erick Archer
---
.../ethernet/marvell/prestera/prestera_hw.c | 83 +--
1 file changed, 37 insertions(+), 46 deletions(-)
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_hw.c
b/drivers/net/ethernet
Hi Kees, Jiri and Luiz,
First of all, thanks for the reviews.
On Mon, May 13, 2024 at 12:29:04PM -0400, Luiz Augusto von Dentz wrote:
> Hi Jiri, Eric,
>
> On Mon, May 13, 2024 at 1:07 AM Jiri Slaby wrote:
> >
> > On 12. 05. 24, 13:17, Erick Archer wrote:
> > > T
Hi Kees and Luiz,
First of all, thanks for the reviews.
On Mon, May 13, 2024 at 12:31:29PM -0400, Luiz Augusto von Dentz wrote:
> Hi Eric,
>
> On Sun, May 12, 2024 at 11:08 PM Kees Cook wrote:
> >
> > On Sun, May 12, 2024 at 04:17:06PM +0200, Erick Archer wrote:
> >
ous versions:
v2 ->
https://lore.kernel.org/linux-hardening/as8pr02mb7237262c62b054fabd7229168b...@as8pr02mb7237.eurprd02.prod.outlook.com/
v1 ->
https://lore.kernel.org/linux-hardening/as8pr02mb723725e0069f7ae8f64e876e8b...@as8pr02mb7237.eurprd02.prod.outlook.com/
---
Erick Archer (2):
tty: rfcomm: prefer
he code is more readable and safer.
This code was detected with the help of Coccinelle, and audited and
modified manually.
Link:
https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
R
Refactor the list_for_each_entry() loop of rfcomm_get_dev_list()
function to use array indexing instead of pointer arithmetic.
This way, the code is more readable and idiomatic.
Reviewed-by: Kees Cook
Signed-off-by: Erick Archer
---
net/bluetooth/rfcomm/tty.c | 12 ++--
1 file changed
/160 [2]
---
Changes in v2:
- Add the "Reviewed-by:" tags.
- Split the changes in two commits (Luiz Augusto von Dentz).
Previous versions:
v1 ->
https://lore.kernel.org/linux-hardening/as8pr02mb7237ecd397bdb7f529adc7468b...@as8pr02mb7237.eurprd02.prod.outlook.com/
---
Erick Archer
/issues/160 [2]
Reviewed-by: Kees Cook
Signed-off-by: Erick Archer
---
include/net/bluetooth/hci_sock.h | 2 +-
net/bluetooth/hci_core.c | 11 ---
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/include/net/bluetooth/hci_sock.h b/include/net/bluetooth/hci_sock.h
ind
Refactor the list_for_each_entry() loop of hci_get_dev_list()
function to use array indexing instead of pointer arithmetic.
This way, the code is more readable and idiomatic.
Reviewed-by: Kees Cook
Signed-off-by: Erick Archer
---
net/bluetooth/hci_core.c | 4 ++--
1 file changed, 2 insertions
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.
Signed-off-by: Erick Archer
---
drivers/bluetooth/btrtl.c | 2 +-
drivers
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.
Signed-off-by: Erick Archer
---
drivers/input/keyboard/atkbd.c | 2 +-
drivers
nd safer.
Link:
https://www.kernel.org/doc/html/next/process/deprecated.html#zero-length-and-one-element-arrays
[1]
Closes: https://github.com/KSPP/linux/issues/333
Signed-off-by: Erick Archer
---
Hi,
The idea behind this patch is extracted from the ones sent by Gustavo
A. R. Silva [1] but
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.
Signed-off-by: Erick Archer
---
.../broadcom/brcm80211/brcmfmac/bcmsdh.c | 4
Spriel
Signed-off-by: Erick Archer
---
Changes in v2:
- Remove some redundant NULL initializations (Arend van Spriel).
- Refactor a bit the logic of "phy_lcn.c" (Arend van Spriel).
- Add the "Acked-by:" tag.
Previous versions:
v1 ->
https://lore.ker
Hi,
On Wed, May 01, 2024 at 07:01:22PM +0200, Erick Archer wrote:
> Prepare for the coming implementation by GCC and Clang of the
> __counted_by attribute. Flexible array members annotated with
> __counted_by can have their accesses bounds-checked at run-time via
> CONFIG_UBSAN_BOUND
pared to the previous version, of the second
rb_alloc() function to gain __counted_by() coverage (Kees Cook and
Christophe JAILLET).
Changes in v2:
- Annotate "struct perf_buffer" with __counted_by() attribute (Kees Cook).
- Refactor the logic to gain __counted_by() coverage (Kee
ux/issues/160 [2]
Suggested-by: Christophe JAILLET
Reviewed-by: Kees Cook
Signed-off-by: Erick Archer
---
arch/x86/events/amd/uncore.c | 18 +-
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c
index 0fafe233b
was detected with the help of Coccinelle, and audited and
modified manually.
Link:
https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Reviewed-by: Kees Cook
Signed-off-by: Erick Archer
---
d after the
"nr_pages" assignment.
This way, the code is more safer.
This code was detected with the help of Coccinelle, and audited and
modified manually.
Link:
https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https:
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.
Signed-off-by: Erick Archer
---
drivers/nvdimm/btt.c | 4 ++--
1 file changed, 2
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.
Signed-off-by: Erick Archer
---
drivers/soc/fsl/qe/ucc_fast.c | 2 +-
drivers/soc/fsl
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.
Signed-off-by: Erick Archer
---
drivers/auxdisplay/arm-charlcd.c | 2 +-
drivers
_FORTIFY_SOURCE
(for strcpy/memcpy-family functions).
This way, the code is more readable and safer.
Regards,
Erick
Link:
https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
---
Erick
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.
At the same time remove some redundant NULL initializations.
Signed-off-by: Erick
arithmetic-in-allocator-arguments
[1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer
---
drivers/net/wireless/atmel/at76c50x-usb.c | 12 ++--
drivers/net/wireless/atmel/at76c50x-usb.h | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/driver
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.
Signed-off-by: Erick Archer
---
drivers/input/misc/88pm80x_onkey.c | 2 +-
drivers
1 - 100 of 111 matches
Mail list logo