search for: kmemdup

Displaying 20 results from an estimated 188 matches for "kmemdup".

2019 Jul 03
3
[PATCH v2 06/35] crypto: Use kmemdup rather than duplicating its implementation
kmemdup is introduced to duplicate a region of memory in a neat way. Rather than kmalloc/kzalloc + memcpy, which the programmer needs to write the size twice (sometimes lead to mistakes), kmemdup improves readability, leads to smaller code and also reduce the chances of mistakes. Suggestion to use kmemdup...
2019 Jul 03
3
[PATCH v2 06/35] crypto: Use kmemdup rather than duplicating its implementation
kmemdup is introduced to duplicate a region of memory in a neat way. Rather than kmalloc/kzalloc + memcpy, which the programmer needs to write the size twice (sometimes lead to mistakes), kmemdup improves readability, leads to smaller code and also reduce the chances of mistakes. Suggestion to use kmemdup...
2019 Jul 03
0
[PATCH 05/30] crypto: Use kmemdup rather than duplicating its implementation
kmemdup is introduced to duplicate a region of memory in a neat way. Rather than kmalloc/kzalloc + memset, which the programmer needs to write the size twice (sometimes lead to mistakes), kmemdup improves readability, leads to smaller code and also reduce the chances of mistakes. Suggestion to use kmemdup...
2019 Jul 03
0
[PATCH v2 06/35] crypto: Use kmemdup rather than duplicating its implementation
On Thu, Jul 04, 2019 at 12:27:08AM +0800, Fuqian Huang wrote: > kmemdup is introduced to duplicate a region of memory in a neat way. > Rather than kmalloc/kzalloc + memcpy, which the programmer needs to > write the size twice (sometimes lead to mistakes), kmemdup improves > readability, leads to smaller code and also reduce the chances of mistakes. > Sugges...
2020 Apr 21
1
[PATCH -next] drm/nouveau/acr: Use kmemdup instead of kmalloc and memcpy
Fixes coccicheck warning: drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c:103:23-30: WARNING opportunity for kmemdup drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c:113:22-29: WARNING opportunity for kmemdup Fixes: 22dcda45a3d1 ("drm/nouveau/acr: implement new subdev to replace "secure boot"") Reported-by: Hulk Robot <hulkci at huawei.com> Signed-off-by: Zou Wei <zou_wei at huawei.com...
2013 Mar 10
1
[PATCH] fs: fs2fs: Replaced calls to kmalloc and memcpy with kmemdup
Replaced calls to kmalloc followd by memcpy with a single call to kmemdup. This patch was found using coccicheck. Signed-off-by: Alexandru Gheorghiu <gheorghiuandru at gmail.com> --- fs/ocfs2/localalloc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index aebeacd..839183f 100644 --- a/f...
2023 Dec 14
2
[PATCH linux-next] drm/nouveau/disp: switch to use kmemdup() helper
From: Yang Guang <yang.guang5 at zte.com.cn> Use kmemdup() helper instead of open-coding to simplify the code. Signed-off-by: Chen Haonan <chen.haonan2 at zte.com.cn> --- drivers/gpu/drm/nouveau/nvif/outp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvif/outp.c b/drivers/gpu/drm/nouveau/nvif/outp...
2013 Mar 11
2
[PATCH] block: replace kmalloc and then memcpy with kmemdup
...ont.c index c3dae2e..9620644 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -1203,11 +1203,10 @@ static int blkif_recover(struct blkfront_info *info) int j; /* Stage 1: Make a safe copy of the shadow state. */ - copy = kmalloc(sizeof(info->shadow), + copy = kmemdup(info->shadow, sizeof(info->shadow), GFP_NOIO | __GFP_REPEAT | __GFP_HIGH); if (!copy) return -ENOMEM; - memcpy(copy, info->shadow, sizeof(info->shadow)); /* Stage 2: Set up free list. */ memset(&info->shadow, 0, sizeof(info->shadow)); -- 1.7.10.4
2013 Mar 11
2
[PATCH] block: replace kmalloc and then memcpy with kmemdup
...ont.c index c3dae2e..9620644 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -1203,11 +1203,10 @@ static int blkif_recover(struct blkfront_info *info) int j; /* Stage 1: Make a safe copy of the shadow state. */ - copy = kmalloc(sizeof(info->shadow), + copy = kmemdup(info->shadow, sizeof(info->shadow), GFP_NOIO | __GFP_REPEAT | __GFP_HIGH); if (!copy) return -ENOMEM; - memcpy(copy, info->shadow, sizeof(info->shadow)); /* Stage 2: Set up free list. */ memset(&info->shadow, 0, sizeof(info->shadow)); -- 1.7.10.4
2024 Jan 09
1
[PATCH linux-next v2] drm/nouveau/disp: switch to use kmemdup() helper
From: Chen Haonan <chen.haonan2 at zte.com.cn> Use kmemdup() helper instead of open-coding to simplify the code. Signed-off-by: Chen Haonan <chen.haonan2 at zte.com.cn> Reviewed-by: Yang Guang <yang.guang5 at zte.com.cn> --- drivers/gpu/drm/nouveau/nvif/outp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/d...
2016 Dec 23
1
[PATCH] net: Use kmemdup instead of kmalloc and memcpy
when some other buffer is immediately copied into allocated region. Replace calls to kmalloc followed by a memcpy with a direct call to kmemdup. Signed-off-by: Shyam Saini <mayhs11saini at gmail.com> --- drivers/net/virtio_net.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index ba1aa24..dde4bc4 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virti...
2016 Dec 23
1
[PATCH] net: Use kmemdup instead of kmalloc and memcpy
when some other buffer is immediately copied into allocated region. Replace calls to kmalloc followed by a memcpy with a direct call to kmemdup. Signed-off-by: Shyam Saini <mayhs11saini at gmail.com> --- drivers/net/virtio_net.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index ba1aa24..dde4bc4 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virti...
2024 Jan 10
0
[PATCH linux-next v2] drm/nouveau/disp: switch to use kmemdup() helper
On 1/9/24 07:24, yang.guang5 at zte.com.cn wrote: > From: Chen Haonan <chen.haonan2 at zte.com.cn> > > Use kmemdup() helper instead of open-coding to > simplify the code. > > Signed-off-by: Chen Haonan <chen.haonan2 at zte.com.cn> > Reviewed-by: Yang Guang <yang.guang5 at zte.com.cn> Applied to drm-misc-next, thanks! > --- > drivers/gpu/drm/nouveau/nvif/outp.c | 3 +-- > 1...
2019 Oct 12
0
drm/nouveau: Checking a kmemdup() call in nouveau_connector_of_detect()
Hello, I tried another script for the semantic patch language out. This source code analysis approach points out that the implementation of the function ?nouveau_connector_of_detect? contains still an unchecked call of the function ?kmemdup?. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/nouveau/nouveau_connector.c?id=1c0cc5f1ae5ee5a6913704c0d75a6e99604ee30a#n476 https://elixir.bootlin.com/linux/v5.4-rc2/source/drivers/gpu/drm/nouveau/nouveau_connector.c#L476 How do you think about to improve...
2016 Dec 28
0
[PATCH] net: Use kmemdup instead of kmalloc and memcpy
From: Shyam Saini <mayhs11saini at gmail.com> Date: Sat, 24 Dec 2016 00:44:58 +0530 > when some other buffer is immediately copied into allocated region. > Replace calls to kmalloc followed by a memcpy with a direct > call to kmemdup. > > Signed-off-by: Shyam Saini <mayhs11saini at gmail.com> Applied.
2023 Dec 14
0
[PATCH linux-next] drm/nouveau/disp: switch to use kmemdup() helper
On Thu, Dec 14, 2023 at 08:03:22PM +0800, yang.guang5 at zte.com.cn wrote: > From: Yang Guang <yang.guang5 at zte.com.cn> > > Use kmemdup() helper instead of open-coding to > simplify the code. > > Signed-off-by: Chen Haonan <chen.haonan2 at zte.com.cn> Sure, good cleanup. Reviewed-by: Kees Cook <keescook at chromium.org> -- Kees Cook
2016 Nov 02
3
[PATCH] gr: fallback to legacy paths during firmware lookup
...f, device->dev); + if (ret) { + snprintf(f, sizeof(f), "nouveau/%s", fwname); + ret = request_firmware(&fw, f, device->dev); + if (ret) { + nvkm_error(subdev, "failed to load %s\n", fwname); + return ret; + } + } + + fuc->size = fw->size; + fuc->data = kmemdup(fw->data, fuc->size, GFP_KERNEL); + release_firmware(fw); + return (fuc->data != NULL) ? 0 : -ENOMEM; +} + +int gf100_gr_ctor_fw(struct gf100_gr *gr, const char *fwname, struct gf100_gr_fuc *fuc) { struct nvkm_subdev *subdev = &gr->base.engine.subdev; struct nvkm_device *d...
2020 Apr 13
0
[PATCH 2/2] crypto: Remove unnecessary memzero_explicit()
...t crypto_skcipher *tfm, const u8 *key, dev_dbg(ce->dev, "ERROR: Invalid keylen %u\n", keylen); return -EINVAL; } - if (op->key) { - memzero_explicit(op->key, op->keylen); - kfree(op->key); - } + kfree_sensitive(op->key); op->keylen = keylen; op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA); if (!op->key) @@ -416,10 +410,7 @@ int sun8i_ce_des3_setkey(struct crypto_skcipher *tfm, const u8 *key, if (err) return err; - if (op->key) { - memzero_explicit(op->key, op->keylen); - kfree(op->key); - } + free_sensitive(op->key, op-...
2020 Apr 13
1
[PATCH 2/2] crypto: Remove unnecessary memzero_explicit()
..._dbg(ce->dev, "ERROR: Invalid keylen %u\n", keylen); > return -EINVAL; > } > - if (op->key) { > - memzero_explicit(op->key, op->keylen); > - kfree(op->key); > - } > + kfree_sensitive(op->key); > op->keylen = keylen; > op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA); > if (!op->key) It might be a defect to set op->keylen before the kmemdup succeeds. > @@ -416,10 +410,7 @@ int sun8i_ce_des3_setkey(struct crypto_skcipher *tfm, const u8 *key, > if (err) > return err; > > - if (op->key) { &gt...
2020 Apr 13
1
[PATCH 2/2] crypto: Remove unnecessary memzero_explicit()
..._dbg(ce->dev, "ERROR: Invalid keylen %u\n", keylen); > return -EINVAL; > } > - if (op->key) { > - memzero_explicit(op->key, op->keylen); > - kfree(op->key); > - } > + kfree_sensitive(op->key); > op->keylen = keylen; > op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA); > if (!op->key) It might be a defect to set op->keylen before the kmemdup succeeds. > @@ -416,10 +410,7 @@ int sun8i_ce_des3_setkey(struct crypto_skcipher *tfm, const u8 *key, > if (err) > return err; > > - if (op->key) { &gt...