[PATCH v6 1/4] PCI: endpoint: pci-epf-test: Fix the check for DMA MEMCPY test

2025-01-16 Thread Manivannan Sadhasivam
Currently, if DMA MEMCPY test is requested by the host, and if the endpoint DMA controller supports DMA_PRIVATE, the test will fail. This is not correct since there is no check for DMA_MEMCPY capability and the DMA controller can support both DMA_PRIVATE and DMA_MEMCPY. So fix the check and also

Re: [PATCH v5 1/4] PCI: endpoint: pci-epf-test: Fix the check for DMA MEMCPY test

2025-01-16 Thread Niklas Cassel
On Thu, Jan 16, 2025 at 07:21:03PM +0530, Manivannan Sadhasivam wrote: > Currently, if DMA MEMCPY test is requested by the host, and if the endpoint > DMA controller supports DMA_PRIVATE, the test will fail. This is not > correct since there is no check for DMA_MEMCPY capability an

[PATCH v5 1/4] PCI: endpoint: pci-epf-test: Fix the check for DMA MEMCPY test

2025-01-16 Thread Manivannan Sadhasivam
Currently, if DMA MEMCPY test is requested by the host, and if the endpoint DMA controller supports DMA_PRIVATE, the test will fail. This is not correct since there is no check for DMA_MEMCPY capability and the DMA controller can support both DMA_PRIVATE and DMA_MEMCPY. So fix the check and also

Re: [PATCH] selftests: vDSO: align stack for O2-optimized memcpy

2024-09-27 Thread Shuah Khan
On 9/27/24 11:24, Jason A. Donenfeld wrote: Hi Shuah, On Tue, Sep 24, 2024 at 01:47:23PM +0200, Jason A. Donenfeld wrote: When switching on -O2, gcc generates SSE2 instructions that assume a 16-byte aligned stack, which the standalone test's start point wasn't aligning. Fix this with the usual

Re: [PATCH] selftests: vDSO: align stack for O2-optimized memcpy

2024-09-27 Thread Jason A. Donenfeld
Hi Shuah, On Tue, Sep 24, 2024 at 01:47:23PM +0200, Jason A. Donenfeld wrote: > When switching on -O2, gcc generates SSE2 instructions that assume a > 16-byte aligned stack, which the standalone test's start point wasn't > aligning. Fix this with the usual alignnent sequence. > > Fixes: ecb8bd70d

[PATCH] selftests: vDSO: align stack for O2-optimized memcpy

2024-09-24 Thread Jason A. Donenfeld
When switching on -O2, gcc generates SSE2 instructions that assume a 16-byte aligned stack, which the standalone test's start point wasn't aligning. Fix this with the usual alignnent sequence. Fixes: ecb8bd70d51 ("selftests: vDSO: build tests with O2 optimization") Reported-by: kernel test robot

[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

[gustavoars-linux:testing/warray-bounds 1/13] net/sctp/sm_make_chunk.c:3150:4: warning: 'memcpy' offset [17, 28] from the object at 'addr' is out of the bounds of referenced subobject 'v4' with type '

2021-04-15 Thread kernel test robot
nction 'sctp_process_asconf_param', inlined from 'sctp_process_asconf' at net/sctp/sm_make_chunk.c:3285:14: >> net/sctp/sm_make_chunk.c:3150:4: warning: 'memcpy' offset [17, 28] from the >> object at 'addr' is out of the bounds of referenced subobject &#

[gustavoars-linux:testing/warray-bounds 1/10] net/core/flow_dissector.c:835:3: warning: 'memcpy' offset [33, 48] from the object at 'flow_keys' is out of the bounds of referenced subobject 'ipv6_src'

2021-04-14 Thread kernel test robot
Reported-by: kernel test robot All warnings (new ones prefixed by >>): In function '__skb_flow_bpf_to_target', inlined from '__skb_flow_dissect' at net/core/flow_dissector.c:1014:4: >> net/core/flow_dissector.c:835:3: warning: 'memcpy' offset

[PATCH 5.11 145/152] staging: rtl8192e: Fix incorrect source in memcpy()

2021-04-05 Thread Greg Kroah-Hartman
bytes (the 4th and 5th element of u8 "data[]" array) are copied into "network->CcxRmState". Right now the code uses "memcpy()" with the source as "&info_element[4]" which would copy in wrong and unintended information. The struct "rtllib_info_el

[PATCH 5.10 120/126] staging: rtl8192e: Fix incorrect source in memcpy()

2021-04-05 Thread Greg Kroah-Hartman
bytes (the 4th and 5th element of u8 "data[]" array) are copied into "network->CcxRmState". Right now the code uses "memcpy()" with the source as "&info_element[4]" which would copy in wrong and unintended information. The struct "rtllib_info_el

[PATCH 5.4 72/74] staging: rtl8192e: Fix incorrect source in memcpy()

2021-04-05 Thread Greg Kroah-Hartman
bytes (the 4th and 5th element of u8 "data[]" array) are copied into "network->CcxRmState". Right now the code uses "memcpy()" with the source as "&info_element[4]" which would copy in wrong and unintended information. The struct "rtllib_info_el

[PATCH 4.19 54/56] staging: rtl8192e: Fix incorrect source in memcpy()

2021-04-05 Thread Greg Kroah-Hartman
bytes (the 4th and 5th element of u8 "data[]" array) are copied into "network->CcxRmState". Right now the code uses "memcpy()" with the source as "&info_element[4]" which would copy in wrong and unintended information. The struct "rtllib_info_el

[PATCH 4.14 50/52] staging: rtl8192e: Fix incorrect source in memcpy()

2021-04-05 Thread Greg Kroah-Hartman
bytes (the 4th and 5th element of u8 "data[]" array) are copied into "network->CcxRmState". Right now the code uses "memcpy()" with the source as "&info_element[4]" which would copy in wrong and unintended information. The struct "rtllib_info_el

[PATCH 4.9 32/35] staging: rtl8192e: Fix incorrect source in memcpy()

2021-04-05 Thread Greg Kroah-Hartman
bytes (the 4th and 5th element of u8 "data[]" array) are copied into "network->CcxRmState". Right now the code uses "memcpy()" with the source as "&info_element[4]" which would copy in wrong and unintended information. The struct "rtllib_info_el

[PATCH 4.4 27/28] staging: rtl8192e: Fix incorrect source in memcpy()

2021-04-05 Thread Greg Kroah-Hartman
bytes (the 4th and 5th element of u8 "data[]" array) are copied into "network->CcxRmState". Right now the code uses "memcpy()" with the source as "&info_element[4]" which would copy in wrong and unintended information. The struct "rtllib_info_el

Re: [PATCH v2 1/2] staging: rtl8192e: Fix incorrect source in memcpy()

2021-03-23 Thread Atul Gopinathan
d, "CcxRmState" was used in the same memcpy() of the first patch. I caught the error in it's type while trying to fix the first. Thank you for your encouraging words :D Regards, Atul

Re: [PATCH v2 1/2] staging: rtl8192e: Fix incorrect source in memcpy()

2021-03-23 Thread Dan Carpenter
Reviewed-by: Dan Carpenter This is very clever detective work. How did you spot the bug? regards, dan carpenter

[PATCH v2 1/2] staging: rtl8192e: Fix incorrect source in memcpy()

2021-03-23 Thread Atul Gopinathan
The "len" field defines the size of the "data[]" array. The code is supposed to check if "info_element->len" is greater than 4 and later equal to 6. If this is satisfied then, the last two bytes (the 4th and 5th element of u8 "data[]" array) are copied into &q

Re: [PATCH] ethernet: ucc_geth: Use kmemdup instead of kmalloc and memcpy

2021-03-09 Thread Rasmus Villemoes
;ugeth_primary_info, sizeof(*ug_info), GFP_KERNEL); > if (ug_info == NULL) > return -ENOMEM; > - memcpy(ug_info, &ugeth_primary_info, sizeof(*ug_info)); > > ug_info->uf_info.ucc_num = ucc_num; > > Ah, yes, of course, I should have used that. Acked-by: Rasmus Villemoes

[PATCH] iwlwifi: mvm: Use kmemdup instead of kzalloc and memcpy

2021-03-05 Thread angkery
PTR(-ENOMEM); - memcpy(resp, cmd.resp_pkt->data, resp_size); - iwl_free_resp(&cmd); return resp; } -- 1.9.1

[PATCH] ethernet: ucc_geth: Use kmemdup instead of kmalloc and memcpy

2021-03-05 Thread angkery
; 0) || (ucc_num > 7)) return -ENODEV; - ug_info = kmalloc(sizeof(*ug_info), GFP_KERNEL); + ug_info = kmemdup(&ugeth_primary_info, sizeof(*ug_info), GFP_KERNEL); if (ug_info == NULL) return -ENOMEM; - memcpy(ug_info, &uget

Re: [PATCH 1/2] staging: rtl8192e: Pass array value to memcpy instead of struct pointer

2021-02-20 Thread Atul Gopinathan
rest (to which this patch applies) is > > supposed to check if the "info_element->len" is greater than 4 and > > equal to 6, if this is satisfied then, the last two bytes (the > > 4th and 5th index of u8 "data" array) are copied into > > "

[PATCH 1/2] staging: rtl8192e: Pass array value to memcpy instead of struct pointer

2021-02-20 Thread Atul Gopinathan
>CcxRmState". Currently the code uses "memcpy()" with the source as "&info_element[4]" which would copy in wrong and unintended information. This patch rectifies this error by using "&info_element->data[4]" which rightly copies the last two bytes a

[PATCH] riscv: fix memmove and optimise memcpy when misalign

2021-02-16 Thread Gary Guo
regression on hardware that traps misaligned load/store and emulate them using firmware. The current behaviour of memcpy is that it checks if both src and dest pointers are co-aligned (aka congruent modular SZ_REG). If aligned, it will copy data word-by-word after first aligning pointers to word

[gustavoars-linux:testing/uapi/nfsd/nfsfh 1/2] drivers/media/pci/ngene/ngene-core.c:388:2: warning: 'memcpy' offset [12, 16] from the object at 'com' is out of the bounds of referenced subobject 'conf

2021-02-09 Thread kernel test robot
/ngene-core.c: In function 'ngene_command_config_free_buf': >> drivers/media/pci/ngene/ngene-core.c:388:2: warning: 'memcpy' offset [12, >> 16] from the object at 'com' is out of the bounds of referenced subobject >> 'config' with type

Re: [PATCH v2 0/3] dmaengine: ti: k3-udma: memcpy throughput improvement

2021-01-13 Thread Vinod Koul
On 13-01-21, 13:49, Peter Ujfalusi wrote: > Hi, > > Changes since v1: > - Added Kishon's tested-by to the first two patch > - Moved the variable definitions to the start of their respective functions > - Remove braces where they are not needed > - correct indentation of cases > - additional patch

[PATCH v2 0/3] dmaengine: ti: k3-udma: memcpy throughput improvement

2021-01-13 Thread Peter Ujfalusi
Hi, Changes since v1: - Added Kishon's tested-by to the first two patch - Moved the variable definitions to the start of their respective functions - Remove braces where they are not needed - correct indentation of cases - additional patch to clean up the ret = 0 initializations in tisci channel

Re: [PATCH 0/2] dmaengine: ti: k3-udma: memcpy throughput improvement

2021-01-11 Thread Kishon Vijay Abraham I
Hi, On 14/12/20 1:43 pm, Peter Ujfalusi wrote: > Hi, > > Newer members of the KS3 family (after AM654) have support for burst_size > configuration for each DMA channel. > > The HW default value is 64 bytes but on higher throughput channels it can be > increased to 256 bytes (UCHANs) or 128 byes

Re: [PATCH v3 3/3] i2c: smbus: switch from loops to memcpy

2021-01-11 Thread Wolfram Sang
On Tue, Nov 12, 2019 at 12:31:32PM -0800, Dmitry Torokhov wrote: > When copying memory from one buffer to another, instead of open-coding > loops with byte-by-byte copies let's use memcpy() which might be a bit > faster and makes intent more clear. > > Signed-off-by: Dmitry To

[PATCH 0/2] dmaengine: ti: k3-udma: memcpy throughput improvement

2020-12-14 Thread Peter Ujfalusi
Hi, Newer members of the KS3 family (after AM654) have support for burst_size configuration for each DMA channel. The HW default value is 64 bytes but on higher throughput channels it can be increased to 256 bytes (UCHANs) or 128 byes (HCHANs). Aligning the buffers and length of the transfer to

Re: [PATCH] drm/amd/pm: Use kmemdup instead of kmalloc and memcpy

2020-11-10 Thread Alex Deucher
gt; > - pptable_information->smc_pptable = kmalloc(sizeof(PPTable_t), > GFP_KERNEL); > + pptable_information->smc_pptable = > kmemdup(&(powerplay_table->smcPPTable), > + sizeof(PPTable_t), > GFP_KERNEL); >

[PATCH] drm/amd/pm: Use kmemdup instead of kmalloc and memcpy

2020-11-10 Thread Tian Tao
p;(powerplay_table->smcPPTable), + sizeof(PPTable_t), GFP_KERNEL); if (pptable_information->smc_pptable == NULL) return -ENOMEM; - memcpy(pptable_information->smc_pptable, &(powerplay_table->smcPPTable), sizeof(PPTable_t)); - result = app

[PATCH v2] drm/amd/pm: replace kmalloc+memcpy by kmemdup

2020-10-29 Thread Deepak R Varma
Use kmemdup() for instructions using kmalloc() + memcpy(). More information here: https://lwn.net/Articles/198928/ Issue reported by coccinelle script: scripts/coccinelle/api/memdup.cocci Signed-off-by: Deepak R Varma --- Changes since v1: - Update patch subject and log message to match

[PATCH 2/3][next] lib/stackdepot.c: Use flex_array_size() helper in memcpy()

2020-10-01 Thread Gustavo A. R. Silva
*depot_alloc_stack(unsigned long *entries, int size, stack->handle.slabindex = depot_index; stack->handle.offset = depot_offset >> STACK_ALLOC_ALIGN; stack->handle.valid = 1; - memcpy(stack->entries, entries, size * sizeof(unsigned long)); + mem

[PATCH 5.8 32/56] bnxt_en: Use memcpy to copy VPD field info.

2020-09-25 Thread Greg Kroah-Hartman
From: Vasundhara Volam [ Upstream commit 492adcf481292521ee8df1a482dc12acdb28aa15 ] Using strlcpy() to copy from VPD is not correct because VPD strings are not necessarily NULL terminated. Use memcpy() to copy the VPD length up to the destination buffer size - 1. The destination is zeroed

Re: [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy

2020-09-21 Thread Alex Dewar
Hmm, I applied this already: commit 33f290811d4c1a09c4e92f5bf0458525835dbcba Author: Alex Dewar Date: Wed Sep 9 20:02:08 2020 +0100 drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of this pattern

Re: [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy

2020-09-21 Thread Neil Armstrong
On 20/09/2020 10:24, Daniel Vetter wrote: > On Sat, Sep 19, 2020 at 9:31 PM Alex Dewar wrote: >> >> On 2020-09-11 13:57, Neil Armstrong wrote: >>> On 09/09/2020 21:02, Alex Dewar wrote: >>>> kmemdup can be used instead of kmalloc+memcpy. Replace an occurren

Re: [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy

2020-09-21 Thread Neil Armstrong
On 20/09/2020 10:24, Daniel Vetter wrote: > On Sat, Sep 19, 2020 at 9:31 PM Alex Dewar wrote: >> >> On 2020-09-11 13:57, Neil Armstrong wrote: >>> On 09/09/2020 21:02, Alex Dewar wrote: >>>> kmemdup can be used instead of kmalloc+memcpy. Replace an occurren

Re: [PATCH 3/3] exfat: replace memcpy with structure assignment

2020-09-20 Thread Namjae Jeon
2020-09-15 19:23 GMT-07:00, Sungjong Seo : >> Use structure assignment instead of memcpy. >> >> Signed-off-by: Tetsuhiro Kohada > > Acked-by: Sungjong Seo Applied. Thanks for your patch!

Re: [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy

2020-09-20 Thread Daniel Vetter
On Sat, Sep 19, 2020 at 9:31 PM Alex Dewar wrote: > > On 2020-09-11 13:57, Neil Armstrong wrote: > > On 09/09/2020 21:02, Alex Dewar wrote: > >> kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of > >> this pattern. > Friendly ping? > >

Re: [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy

2020-09-19 Thread Alex Dewar
On 2020-09-11 13:57, Neil Armstrong wrote: On 09/09/2020 21:02, Alex Dewar wrote: kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of this pattern. Friendly ping? Issue identified with Coccinelle. Signed-off-by: Alex Dewar --- drivers/gpu/drm/bridge/synopsys/dw-mipi

RE: [PATCH 3/3] exfat: replace memcpy with structure assignment

2020-09-15 Thread Sungjong Seo
> Use structure assignment instead of memcpy. > > Signed-off-by: Tetsuhiro Kohada Acked-by: Sungjong Seo > --- > fs/exfat/dir.c | 7 ++- > fs/exfat/inode.c | 2 +- > fs/exfat/namei.c | 15 +++ > 3 files changed, 10 insertions(+), 14 deletions(-) &g

Re: [PATCH] ima: Use kmemdup rather than kmalloc+memcpy

2020-09-15 Thread Mimi Zohar
On Wed, 2020-09-09 at 20:09 +0100, Alex Dewar wrote: > Issue identified with Coccinelle. > > Signed-off-by: Alex Dewar Thank you. Mimi

[PATCH v5 08/14] arm64: Import latest optimization of memcpy

2020-09-14 Thread Oliver Swede
From: Sam Tebbs Import the latest memcpy implementation into memcpy, copy_{from, to and in}_user. The implementation of the user routines is separated into two forms: one for when UAO is enabled and one for when UAO is disabled, with the two being chosen between with a runtime patch. This avoids

[PATCH v5 00/14] Optimise and update memcpy, user copy and string routines

2020-09-14 Thread Oliver Swede
Strings' strcmp arm64: Import latest version of Cortex Strings' strlen arm64: Import latest version of Cortex Strings' strncmp arm64: Import latest optimization of memcpy arch/arm64/include/asm/alternative.h | 36 --- arch/arm64/include/asm/assembler.h | 13 + arch/arm64/include

Re: [PATCH] fs: omfs: use kmemdup() rather than kmalloc+memcpy

2020-09-14 Thread Bob Copeland
On Wed, Sep 09, 2020 at 08:04:15PM +0100, Alex Dewar wrote: > On 24/08/2020 22:17, Alex Dewar wrote: > > Issue identified with Coccinelle. > Gentle ping? > > > > Signed-off-by: Alex Dewar Acked-by: Bob Copeland However, I don't have a git tree for OMFS so you'll need to send it through vfs tre

Re: [PATCH 2/2] printk: ringbuffer: avoid memcpy() on state_var

2020-09-14 Thread Petr Mladek
On Mon 2020-09-14 11:54:03, John Ogness wrote: > @state_var is copied as part of the descriptor copying via > memcpy(). This is not allowed because @state_var is an atomic type, > which in some implementations may contain a spinlock. Great catch! > Avoid using memcpy() with @

[PATCH 2/2] printk: ringbuffer: avoid memcpy() on state_var

2020-09-14 Thread John Ogness
@state_var is copied as part of the descriptor copying via memcpy(). This is not allowed because @state_var is an atomic type, which in some implementations may contain a spinlock. Avoid using memcpy() with @state_var by explicitly copying the other fields of the descriptor. @state_var is set

Re: [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy

2020-09-11 Thread Neil Armstrong
On 09/09/2020 21:02, Alex Dewar wrote: > kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of > this pattern. > > Issue identified with Coccinelle. > > Signed-off-by: Alex Dewar > --- > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +--- >

Re: [PATCH v4 00/14] arm64: Optimise and update memcpy, user copy and string routines

2020-09-11 Thread Oli Swede
t 09:12:49AM +0100, Oli Swede wrote: Version 3 addressed this but I later found some issues with the fixup correctness after further testing, and have partially re-written them here, and addressed some other behaviours of the copy algorithm. [...] I am waiting on access to the relevant machine befo

Re: [PATCH v4 00/14] arm64: Optimise and update memcpy, user copy and string routines

2020-09-11 Thread Catalin Marinas
them > > > here, and addressed some other behaviours of the copy algorithm. > > [...] > > > I am waiting on access to the relevant machine before posting the benchmark > > results for this optimized memcpy, but Sam reported the following with the > >

[PATCH 3/3] exfat: replace memcpy with structure assignment

2020-09-10 Thread Tetsuhiro Kohada
Use structure assignment instead of memcpy. Signed-off-by: Tetsuhiro Kohada --- fs/exfat/dir.c | 7 ++- fs/exfat/inode.c | 2 +- fs/exfat/namei.c | 15 +++ 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index fa5bb72aa295

[PATCH] ima: Use kmemdup rather than kmalloc+memcpy

2020-09-09 Thread Alex Dewar
); - if (!nentry) - return NULL; - /* * Immutable elements are copied over as pointers and data; only * lsm rules can change */ - memcpy(nentry, entry, sizeof(*nentry)); + nentry = kmemdup(entry, sizeof(*nentry), GFP_KERNEL); + if

Re: [PATCH] fs: omfs: use kmemdup() rather than kmalloc+memcpy

2020-09-09 Thread Alex Dewar
ptr = kmemdup(bh->b_data, sb->s_blocksize, GFP_KERNEL); if (!*ptr) { brelse(bh); goto nomem_free; } - memcpy(*ptr, bh->b_data, sb->s_blocksize); if (count &l

[PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy

2020-09-09 Thread Alex Dewar
kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of this pattern. Issue identified with Coccinelle. Signed-off-by: Alex Dewar --- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge

Re: [PATCH 5/8] riscv: use memcpy based uaccess for nommu again

2020-09-08 Thread Palmer Dabbelt
On Sun, 06 Sep 2020 22:58:22 PDT (-0700), Christoph Hellwig wrote: This reverts commit adccfb1a805ea84d2db38eb53032533279bdaa97. Now that the generic uaccess by mempcy code handles unaligned addresses the generic code can be used for all RISC-V CPUs. Signed-off-by: Christoph Hellwig --- arch/

Re: [PATCH v4 00/14] arm64: Optimise and update memcpy, user copy and string routines

2020-09-07 Thread Will Deacon
ere, and addressed some other behaviours of the copy algorithm. [...] > I am waiting on access to the relevant machine before posting the benchmark > results for this optimized memcpy, but Sam reported the following with the > similar (but now slightly older) cortex-strings version:

[PATCH 5/8] riscv: use memcpy based uaccess for nommu again

2020-09-06 Thread Christoph Hellwig
This reverts commit adccfb1a805ea84d2db38eb53032533279bdaa97. Now that the generic uaccess by mempcy code handles unaligned addresses the generic code can be used for all RISC-V CPUs. Signed-off-by: Christoph Hellwig --- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/uaccess.h

[PATCH 5/8] riscv: use memcpy based uaccess for nommu again

2020-09-04 Thread Christoph Hellwig
This reverts commit adccfb1a805ea84d2db38eb53032533279bdaa97. Now that the generic uaccess by mempcy code handles unaligned addresses the generic code can be used for all RISC-V CPUs. Signed-off-by: Christoph Hellwig --- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/uaccess.h

Re: [PATCH] drm/amd/pm: use kmemdup() rather than kmalloc+memcpy

2020-08-24 Thread Alex Deucher
> GFP_KERNEL); > + pptable_information->smc_pptable = > kmemdup(&(powerplay_table->smcPPTable), > + sizeof(PPTable_t), > + GFP_KERNEL); > if (pptable_information->smc_p

[PATCH] ima: use kmemdup() rather than kmalloc+memcpy

2020-08-24 Thread Alex Dewar
change */ - memcpy(nentry, entry, sizeof(*nentry)); memset(nentry->lsm, 0, sizeof_field(struct ima_rule_entry, lsm)); for (i = 0; i < MAX_LSM_RULES; i++) { -- 2.28.0

[PATCH] fs: omfs: use kmemdup() rather than kmalloc+memcpy

2020-08-24 Thread Alex Dewar
FP_KERNEL); if (!*ptr) { brelse(bh); goto nomem_free; } - memcpy(*ptr, bh->b_data, sb->s_blocksize); if (count < sb->s_blocksize) memset((void

[PATCH] drm/amd/pm: use kmemdup() rather than kmalloc+memcpy

2020-08-24 Thread Alex Dewar
eof(PPTable_t), + GFP_KERNEL); if (pptable_information->smc_pptable == NULL) return -ENOMEM; - memcpy(pptable_information->smc_pptable, - &(powerplay_table->smcPPTable), -

[PATCH 5.8 215/232] perf bench mem: Always memset source before memcpy

2020-08-20 Thread Greg Kroah-Hartman
From: Vincent Whitchurch [ Upstream commit 1beaef29c34154ccdcb3f1ae557f6883eda18840 ] For memcpy, the source pages are memset to zero only when --cycles is used. This leads to wildly different results with or without --cycles, since all sources pages are likely to be mapped to the same zero

[PATCH 5.7 185/204] perf bench mem: Always memset source before memcpy

2020-08-20 Thread Greg Kroah-Hartman
From: Vincent Whitchurch [ Upstream commit 1beaef29c34154ccdcb3f1ae557f6883eda18840 ] For memcpy, the source pages are memset to zero only when --cycles is used. This leads to wildly different results with or without --cycles, since all sources pages are likely to be mapped to the same zero

[PATCH 4.19 85/92] perf bench mem: Always memset source before memcpy

2020-08-20 Thread Greg Kroah-Hartman
From: Vincent Whitchurch [ Upstream commit 1beaef29c34154ccdcb3f1ae557f6883eda18840 ] For memcpy, the source pages are memset to zero only when --cycles is used. This leads to wildly different results with or without --cycles, since all sources pages are likely to be mapped to the same zero

[PATCH 4.14 218/228] perf bench mem: Always memset source before memcpy

2020-08-20 Thread Greg Kroah-Hartman
From: Vincent Whitchurch [ Upstream commit 1beaef29c34154ccdcb3f1ae557f6883eda18840 ] For memcpy, the source pages are memset to zero only when --cycles is used. This leads to wildly different results with or without --cycles, since all sources pages are likely to be mapped to the same zero

[PATCH 5.4 141/152] perf bench mem: Always memset source before memcpy

2020-08-20 Thread Greg Kroah-Hartman
From: Vincent Whitchurch [ Upstream commit 1beaef29c34154ccdcb3f1ae557f6883eda18840 ] For memcpy, the source pages are memset to zero only when --cycles is used. This leads to wildly different results with or without --cycles, since all sources pages are likely to be mapped to the same zero

Re: [PATCH v2] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()

2020-08-18 Thread David Miller
From: Miaohe Lin Date: Sat, 15 Aug 2020 04:48:53 -0400 > The frags of skb_shared_info of the data is assigned in following loop. It > is meaningless to do a memcpy of frags here. > > Signed-off-by: Miaohe Lin Applied, thank you.

[PATCH v2] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()

2020-08-15 Thread Miaohe Lin
The frags of skb_shared_info of the data is assigned in following loop. It is meaningless to do a memcpy of frags here. Signed-off-by: Miaohe Lin --- net/core/skbuff.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index afbc1a79dc8a

BUG: unable to handle page fault for address: fe80c000 - EIP: memcpy+0xf/0x20

2020-08-12 Thread Naresh Kamboju
[ 1083.857771] EIP: memcpy+0xf/0x20 [ 1083.857771] Code: 68 d0 7d ee d6 e8 11 1c c7 ff 0f 31 31 c3 59 58 eb 80 cc cc cc cc cc cc cc cc cc 55 89 e5 57 89 c7 56 89 d6 53 89 cb c1 e9 02 a5 89 d9 83 e1 03 74 02 f3 a4 5b 5e 5f 5d c3 90 55 89 e5 57 89 [ 1083.860096] EAX: fe80c000 EBX: 0001 ECX: 4000 EDX

Re: [PATCH] perf bench mem: Always memset source before memcpy

2020-08-12 Thread Arnaldo Carvalho de Melo
Em Mon, Aug 10, 2020 at 03:34:04PM +0200, Vincent Whitchurch escreveu: > For memcpy, the source pages are memset to zero only when --cycles is > used. This leads to wildly different results with or without --cycles, > since all sources pages are likely to be mapped to the same zero page

Re: [PATCH] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()

2020-08-11 Thread Eric Dumazet
On 8/11/20 5:10 AM, linmiaohe wrote: > Eric Dumazet wrote: >> On 8/10/20 5:28 AM, Miaohe Lin wrote: >>> The skb_shared_info part of the data is assigned in the following >>> loop. It is meaningless to do a memcpy here. >>> >> >> Reminder : net-n

Re: [PATCH] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()

2020-08-11 Thread linmiaohe
Eric Dumazet wrote: > On 8/10/20 5:28 AM, Miaohe Lin wrote: >> The skb_shared_info part of the data is assigned in the following >> loop. It is meaningless to do a memcpy here. >> > >Reminder : net-next is CLOSED. > Thanks for your remind. I would wait for it o

Re: [PATCH] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()

2020-08-11 Thread linmiaohe
Florian Westphal wrote: >Miaohe Lin wrote: >> The skb_shared_info part of the data is assigned in the following loop. > >Where? > It's at the below for (i = 0; i < nfrags; i++) loop. But I missed something as Eric Dumazet pointed out. Sorry about it.

Re: [PATCH] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()

2020-08-10 Thread Eric Dumazet
On 8/10/20 5:28 AM, Miaohe Lin wrote: > The skb_shared_info part of the data is assigned in the following loop. It > is meaningless to do a memcpy here. > > Signed-off-by: Miaohe Lin > --- > net/core/skbuff.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --gi

Re: [PATCH] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()

2020-08-10 Thread Florian Westphal
Miaohe Lin wrote: > The skb_shared_info part of the data is assigned in the following loop. Where?

[PATCH] perf bench mem: Always memset source before memcpy

2020-08-10 Thread Vincent Whitchurch
For memcpy, the source pages are memset to zero only when --cycles is used. This leads to wildly different results with or without --cycles, since all sources pages are likely to be mapped to the same zero page without explicit writes. Before this fix: $ export cmd="./perf stat -e LLC-

[PATCH] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()

2020-08-10 Thread Miaohe Lin
The skb_shared_info part of the data is assigned in the following loop. It is meaningless to do a memcpy here. Signed-off-by: Miaohe Lin --- net/core/skbuff.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 7e2e502ef519..5b983c9472f5 100644

Re: [PATCH 1/2][next] mm: memcontrol: Use flex_array_size() helper in memcpy()

2020-08-04 Thread Michal Hocko
(struct > mem_cgroup *memcg, > new->size = size; > > /* Copy thresholds (if any) to new array */ > - if (thresholds->primary) { > - memcpy(new->entries, thresholds->primary->entries, (size - 1) * > - sizeof(struct mem

[PATCH 1/2][next] mm: memcontrol: Use flex_array_size() helper in memcpy()

2020-07-31 Thread Gustavo A. R. Silva
@@ static int __mem_cgroup_usage_register_event(struct mem_cgroup *memcg, new->size = size; /* Copy thresholds (if any) to new array */ - if (thresholds->primary) { - memcpy(new->entries, thresholds->primary->ent

[PATCH 0/2][next] Use flexible_array_size() helper in memcpy()

2020-07-31 Thread Gustavo A. R. Silva
Hi, This small series aims to: 1. Make use of the flexible_array_size() helper in a call to memcpy() 2. While there, use the preferred form for passing the size of a structure type Thanks Gustavo A. R. Silva (2): mm: memcontrol: Use flex_array_size() helper in memcpy() mm: memcontrol: Use

Re: [PATCH][next] mlxsw: spectrum_cnt: Use flex_array_size() helper in memcpy()

2020-07-30 Thread David Miller
From: "Gustavo A. R. Silva" Date: Wed, 29 Jul 2020 17:58:03 -0500 > Make use of the flex_array_size() helper to calculate the size of a > flexible array member within an enclosing structure. > > This helper offers defense-in-depth against potential integer > overflows, while at the same time mak

Re: [PATCH][next] net/sched: act_pedit: Use flex_array_size() helper in memcpy()

2020-07-30 Thread David Miller
From: "Gustavo A. R. Silva" Date: Wed, 29 Jul 2020 22:17:00 -0500 > Make use of the flex_array_size() helper to calculate the size of a > flexible array member within an enclosing structure. > > This helper offers defense-in-depth against potential integer > overflows, while at the same time mak

Re: [PATCH][next] ALSA: vmaster: Use flex_array_size() helper in memcpy()

2020-07-30 Thread Takashi Iwai
e4082cb5f 100644 > >> --- a/sound/core/vmaster.c > >> +++ b/sound/core/vmaster.c > >> @@ -262,7 +262,8 @@ int _snd_ctl_add_follower(struct snd_kcontrol *master, > >> return -ENOMEM; > >>srec->kctl = follower; > >>

Re: [PATCH][next] mlxsw: spectrum_cnt: Use flex_array_size() helper in memcpy()

2020-07-30 Thread Gustavo A. R. Silva
On 7/30/20 04:21, Ido Schimmel wrote: > On Wed, Jul 29, 2020 at 05:58:03PM -0500, Gustavo A. R. Silva wrote: >> Make use of the flex_array_size() helper to calculate the size of a >> flexible array member within an enclosing structure. >> >> This helper offers defense-in-depth against potential

Re: [PATCH][next] ALSA: vmaster: Use flex_array_size() helper in memcpy()

2020-07-30 Thread Gustavo A. R. Silva
, 1 deletion(-) >> >> diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c >> index ab36f9898711..21ce4082cb5f 100644 >> --- a/sound/core/vmaster.c >> +++ b/sound/core/vmaster.c >> @@ -262,7 +262,8 @@ int _snd_ctl_add_follower(struct snd_kcontrol *master, >

Re: [PATCH][next] mlxsw: spectrum_cnt: Use flex_array_size() helper in memcpy()

2020-07-30 Thread Ido Schimmel
On Wed, Jul 29, 2020 at 05:58:03PM -0500, Gustavo A. R. Silva wrote: > Make use of the flex_array_size() helper to calculate the size of a > flexible array member within an enclosing structure. > > This helper offers defense-in-depth against potential integer > overflows, while at the same time ma

Re: [PATCH][next] ALSA: vmaster: Use flex_array_size() helper in memcpy()

2020-07-30 Thread Takashi Iwai
36f9898711..21ce4082cb5f 100644 > --- a/sound/core/vmaster.c > +++ b/sound/core/vmaster.c > @@ -262,7 +262,8 @@ int _snd_ctl_add_follower(struct snd_kcontrol *master, > return -ENOMEM; > srec->kctl = follower; > srec->follower = *follower; > -

[PATCH][next] net/sched: act_pedit: Use flex_array_size() helper in memcpy()

2020-07-29 Thread Gustavo A. R. Silva
int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a, return -ENOBUFS; spin_lock_bh(&p->tcf_lock); - memcpy(opt->keys, p->tcfp_keys, - p->tcfp_nkeys * sizeof(struct tc_pedit_key)); + memcpy(opt->keys, p->tcfp_keys, fle

[PATCH][next] staging: wfx: Use flex_array_size() helper in memcpy()

2020-07-29 Thread Gustavo A. R. Silva
/staging/wfx/hif_tx_mib.c @@ -113,7 +113,7 @@ int hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, if (!val) return -ENOMEM; val->num_of_info_elmts = cpu_to_le32(tbl_len); - memcpy(val->ie_table, tbl, tbl_len * sizeof(*tbl)); + memc

[PATCH][next] mlxsw: spectrum_cnt: Use flex_array_size() helper in memcpy()

2020-07-29 Thread Gustavo A. R. Silva
nit(struct mlxsw_sp *mlxsw_sp) if (!pool) return -ENOMEM; mlxsw_sp->counter_pool = pool; - memcpy(pool->sub_pools, mlxsw_sp_counter_sub_pools, - sub_pools_count * sizeof(*sub_pool)); pool->sub_pools_count = sub_pools_count; +

[PATCH][next] ALSA: hda_codec: Use flex_array_size() helper in memcpy()

2020-07-29 Thread Gustavo A. R. Silva
add_conn_list(struct hda_codec *codec, hda_nid_t nid, int len, return -ENOMEM; p->len = len; p->nid = nid; - memcpy(p->conns, list, len * sizeof(hda_nid_t)); + memcpy(p->conns, list, flex_array_size(p, conns, len)); list_add(&

[PATCH][next] ALSA: vmaster: Use flex_array_size() helper in memcpy()

2020-07-29 Thread Gustavo A. R. Silva
snd_kcontrol *master, return -ENOMEM; srec->kctl = follower; srec->follower = *follower; - memcpy(srec->follower.vd, follower->vd, follower->count * sizeof(*follower->vd)); + memcpy(srec->follower.vd, follower->vd, flex_array

[PATCH 13/40] scsi: ips: Convert strnlen() to memcpy() since result should not be NUL terminated

2020-07-23 Thread Lee Jones
/drivers/scsi/ips.c index ec85ccce96647..2e6077c502fc7 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c @@ -2239,7 +2239,7 @@ ips_get_bios_version(ips_ha_t * ha, int intr) major = 0; minor = 0; - strncpy(ha->bios_version, " ?", 8); + memcpy(ha-

Re: [PATCH v4 00/14] arm64: Optimise and update memcpy, user copy and string routines

2020-07-01 Thread Oli Swede
g the benchmark results for this optimized memcpy, but Sam reported the following with the similar (but now slightly older) cortex-strings version: * copy_from_user: 13.17% * copy_to_user: 4.8% * memcpy: 27.88% * copy_in_user: Didn't appear in the test results. This machine will also be us

[PATCH v4 11/14] arm64: Use additional memcpy macros and fixups

2020-06-30 Thread Oliver Swede
The Arm-provided memcpy routine has been updated with more recent optimizations. The kernel's helper functions for copying to/from user space memory, which import this algorithm and create exception table entries for instructions that reference user space, require new recovery code to accur

[PATCH v4 08/14] arm64: Import latest optimization of memcpy

2020-06-30 Thread Oliver Swede
From: Sam Tebbs Import the latest memcpy implementation into memcpy, copy_{from, to and in}_user. The implementation of the user routines is separated into two forms: one for when UAO is enabled and one for when UAO is disabled, with the two being chosen between with a runtime patch. This avoids

[PATCH v4 00/14] arm64: Optimise and update memcpy, user copy and string routines

2020-06-30 Thread Oliver Swede
byes - is an extension to the original intention of fixing an issue reported by an LTP run last year, where the fixup routine in v2 of this patchset (which was importing the cortex-strings memcpy implementation) would over-report the number of bytes that successfully copied. Version 3 addressed

  1   2   3   4   5   6   7   8   9   10   >