All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] lib: Adjustments for 11 function implementations
@ 2017-10-07 17:46 ` SF Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2017-10-07 17:46 UTC (permalink / raw)
  To: iommu, kasan-dev, Alexander Potapenko, Andrew Morton,
	Andrey Ryabinin, Andy Shevchenko, Christoph Hellwig,
	Daniel Mentz, Dmitry Vyukov, Geert Uytterhoeven, Lars Ellenberg,
	Luis R. Rodriguez, Marek Szyprowski, Mathieu Desnoyers,
	Philipp Reisner, Robin Murphy, Will Deacon
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 7 Oct 2017 19:39:29 +0200

Two update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
  test: Delete five error messages for a failed memory allocation
  Improve a size determination in seven functions

 lib/dma-debug.c                 |  2 +-
 lib/flex_array.c                |  4 ++--
 lib/genalloc.c                  |  2 +-
 lib/lru_cache.c                 |  2 +-
 lib/reed_solomon/reed_solomon.c |  2 +-
 lib/test_kasan.c                |  5 ++---
 lib/test_kmod.c                 | 10 +++-------
 lib/test_list_sort.c            |  9 +++------
 8 files changed, 14 insertions(+), 22 deletions(-)

-- 
2.14.2

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 0/2] lib: Adjustments for 11 function implementations
@ 2017-10-07 17:46 ` SF Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2017-10-07 17:46 UTC (permalink / raw)
  To: iommu, kasan-dev, Alexander Potapenko, Andrew Morton,
	Andrey Ryabinin, Andy Shevchenko, Christoph Hellwig,
	Daniel Mentz, Dmitry Vyukov, Geert Uytterhoeven, Lars Ellenberg,
	Luis R. Rodriguez, Marek Szyprowski, Mathieu Desnoyers,
	Philipp Reisner, Robin Murphy, Will Deacon
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 7 Oct 2017 19:39:29 +0200

Two update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
  test: Delete five error messages for a failed memory allocation
  Improve a size determination in seven functions

 lib/dma-debug.c                 |  2 +-
 lib/flex_array.c                |  4 ++--
 lib/genalloc.c                  |  2 +-
 lib/lru_cache.c                 |  2 +-
 lib/reed_solomon/reed_solomon.c |  2 +-
 lib/test_kasan.c                |  5 ++---
 lib/test_kmod.c                 | 10 +++-------
 lib/test_list_sort.c            |  9 +++------
 8 files changed, 14 insertions(+), 22 deletions(-)

-- 
2.14.2


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] lib/test: Delete five error messages for a failed memory allocation
  2017-10-07 17:46 ` SF Markus Elfring
@ 2017-10-07 17:48   ` SF Markus Elfring
  -1 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2017-10-07 17:48 UTC (permalink / raw)
  To: iommu, kasan-dev, Alexander Potapenko, Andrew Morton,
	Andrey Ryabinin, Andy Shevchenko, Christoph Hellwig,
	Daniel Mentz, Dmitry Vyukov, Geert Uytterhoeven, Lars Ellenberg,
	Luis R. Rodriguez, Marek Szyprowski, Mathieu Desnoyers,
	Philipp Reisner, Robin Murphy, Will Deacon
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 7 Oct 2017 17:34:23 +0200

Omit extra messages for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 lib/test_kasan.c     | 5 ++---
 lib/test_kmod.c      | 8 ++------
 lib/test_list_sort.c | 9 +++------
 3 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/lib/test_kasan.c b/lib/test_kasan.c
index a25c9763fce1..ef1a3ac1397e 100644
--- a/lib/test_kasan.c
+++ b/lib/test_kasan.c
@@ -353,10 +353,9 @@ static noinline void __init memcg_accounted_kmem_cache(void)
 	 */
 	for (i = 0; i < 5; i++) {
 		p = kmem_cache_alloc(cache, GFP_KERNEL);
-		if (!p) {
-			pr_err("Allocation failed\n");
+		if (!p)
 			goto free_cache;
-		}
+
 		kmem_cache_free(cache, p);
 		msleep(100);
 	}
diff --git a/lib/test_kmod.c b/lib/test_kmod.c
index fba78d25e825..337f408b4de6 100644
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -783,10 +783,8 @@ static int kmod_config_sync_info(struct kmod_test_device *test_dev)
 	free_test_dev_info(test_dev);
 	test_dev->info = vzalloc(config->num_threads *
 				 sizeof(struct kmod_test_device_info));
-	if (!test_dev->info) {
-		dev_err(test_dev->dev, "Cannot alloc test_dev info\n");
+	if (!test_dev->info)
 		return -ENOMEM;
-	}
 
 	return 0;
 }
@@ -1089,10 +1087,8 @@ static struct kmod_test_device *alloc_test_dev_kmod(int idx)
 	struct miscdevice *misc_dev;
 
 	test_dev = vzalloc(sizeof(struct kmod_test_device));
-	if (!test_dev) {
-		pr_err("Cannot alloc test_dev\n");
+	if (!test_dev)
 		goto err_out;
-	}
 
 	mutex_init(&test_dev->config_mutex);
 	mutex_init(&test_dev->trigger_mutex);
diff --git a/lib/test_list_sort.c b/lib/test_list_sort.c
index 28e817387b04..5474f3f3e41d 100644
--- a/lib/test_list_sort.c
+++ b/lib/test_list_sort.c
@@ -76,17 +76,14 @@ static int __init list_sort_test(void)
 	pr_debug("start testing list_sort()\n");
 
 	elts = kcalloc(TEST_LIST_LEN, sizeof(*elts), GFP_KERNEL);
-	if (!elts) {
-		pr_err("error: cannot allocate memory\n");
+	if (!elts)
 		return err;
-	}
 
 	for (i = 0; i < TEST_LIST_LEN; i++) {
 		el = kmalloc(sizeof(*el), GFP_KERNEL);
-		if (!el) {
-			pr_err("error: cannot allocate memory\n");
+		if (!el)
 			goto exit;
-		}
+
 		 /* force some equivalencies */
 		el->value = prandom_u32() % (TEST_LIST_LEN / 3);
 		el->serial = i;
-- 
2.14.2

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] lib/test: Delete five error messages for a failed memory allocation
@ 2017-10-07 17:48   ` SF Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2017-10-07 17:48 UTC (permalink / raw)
  To: iommu, kasan-dev, Alexander Potapenko, Andrew Morton,
	Andrey Ryabinin, Andy Shevchenko, Christoph Hellwig,
	Daniel Mentz, Dmitry Vyukov, Geert Uytterhoeven, Lars Ellenberg,
	Luis R. Rodriguez, Marek Szyprowski, Mathieu Desnoyers,
	Philipp Reisner, Robin Murphy, Will Deacon
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 7 Oct 2017 17:34:23 +0200

Omit extra messages for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 lib/test_kasan.c     | 5 ++---
 lib/test_kmod.c      | 8 ++------
 lib/test_list_sort.c | 9 +++------
 3 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/lib/test_kasan.c b/lib/test_kasan.c
index a25c9763fce1..ef1a3ac1397e 100644
--- a/lib/test_kasan.c
+++ b/lib/test_kasan.c
@@ -353,10 +353,9 @@ static noinline void __init memcg_accounted_kmem_cache(void)
 	 */
 	for (i = 0; i < 5; i++) {
 		p = kmem_cache_alloc(cache, GFP_KERNEL);
-		if (!p) {
-			pr_err("Allocation failed\n");
+		if (!p)
 			goto free_cache;
-		}
+
 		kmem_cache_free(cache, p);
 		msleep(100);
 	}
diff --git a/lib/test_kmod.c b/lib/test_kmod.c
index fba78d25e825..337f408b4de6 100644
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -783,10 +783,8 @@ static int kmod_config_sync_info(struct kmod_test_device *test_dev)
 	free_test_dev_info(test_dev);
 	test_dev->info = vzalloc(config->num_threads *
 				 sizeof(struct kmod_test_device_info));
-	if (!test_dev->info) {
-		dev_err(test_dev->dev, "Cannot alloc test_dev info\n");
+	if (!test_dev->info)
 		return -ENOMEM;
-	}
 
 	return 0;
 }
@@ -1089,10 +1087,8 @@ static struct kmod_test_device *alloc_test_dev_kmod(int idx)
 	struct miscdevice *misc_dev;
 
 	test_dev = vzalloc(sizeof(struct kmod_test_device));
-	if (!test_dev) {
-		pr_err("Cannot alloc test_dev\n");
+	if (!test_dev)
 		goto err_out;
-	}
 
 	mutex_init(&test_dev->config_mutex);
 	mutex_init(&test_dev->trigger_mutex);
diff --git a/lib/test_list_sort.c b/lib/test_list_sort.c
index 28e817387b04..5474f3f3e41d 100644
--- a/lib/test_list_sort.c
+++ b/lib/test_list_sort.c
@@ -76,17 +76,14 @@ static int __init list_sort_test(void)
 	pr_debug("start testing list_sort()\n");
 
 	elts = kcalloc(TEST_LIST_LEN, sizeof(*elts), GFP_KERNEL);
-	if (!elts) {
-		pr_err("error: cannot allocate memory\n");
+	if (!elts)
 		return err;
-	}
 
 	for (i = 0; i < TEST_LIST_LEN; i++) {
 		el = kmalloc(sizeof(*el), GFP_KERNEL);
-		if (!el) {
-			pr_err("error: cannot allocate memory\n");
+		if (!el)
 			goto exit;
-		}
+
 		 /* force some equivalencies */
 		el->value = prandom_u32() % (TEST_LIST_LEN / 3);
 		el->serial = i;
-- 
2.14.2


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 2/2] lib: Improve a size determination in seven functions
  2017-10-07 17:46 ` SF Markus Elfring
@ 2017-10-07 17:50   ` SF Markus Elfring
  -1 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2017-10-07 17:50 UTC (permalink / raw)
  To: iommu, kasan-dev, Alexander Potapenko, Andrew Morton,
	Andrey Ryabinin, Andy Shevchenko, Christoph Hellwig,
	Daniel Mentz, Dmitry Vyukov, Geert Uytterhoeven, Lars Ellenberg,
	Luis R. Rodriguez, Marek Szyprowski, Mathieu Desnoyers,
	Philipp Reisner, Robin Murphy, Will Deacon
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 7 Oct 2017 19:19:45 +0200

Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 lib/dma-debug.c                 | 2 +-
 lib/flex_array.c                | 4 ++--
 lib/genalloc.c                  | 2 +-
 lib/lru_cache.c                 | 2 +-
 lib/reed_solomon/reed_solomon.c | 2 +-
 lib/test_kmod.c                 | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index ea4cc3dde4f1..8b5c8fc76f8a 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -993,7 +993,7 @@ void dma_debug_add_bus(struct bus_type *bus)
 	if (dma_debug_disabled())
 		return;
 
-	nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL);
+	nb = kzalloc(sizeof(*nb), GFP_KERNEL);
 	if (nb == NULL) {
 		pr_err("dma_debug_add_bus: out of memory\n");
 		return;
diff --git a/lib/flex_array.c b/lib/flex_array.c
index 2eed22fa507c..ebe0f366b6cb 100644
--- a/lib/flex_array.c
+++ b/lib/flex_array.c
@@ -102,7 +102,7 @@ struct flex_array *flex_array_alloc(int element_size, unsigned int total,
 	/* max_size will end up 0 if element_size > PAGE_SIZE */
 	if (total > max_size)
 		return NULL;
-	ret = kzalloc(sizeof(struct flex_array), flags);
+	ret = kzalloc(sizeof(*ret), flags);
 	if (!ret)
 		return NULL;
 	ret->element_size = element_size;
@@ -167,7 +167,7 @@ __fa_get_part(struct flex_array *fa, int part_nr, gfp_t flags)
 {
 	struct flex_array_part *part = fa->parts[part_nr];
 	if (!part) {
-		part = kmalloc(sizeof(struct flex_array_part), flags);
+		part = kmalloc(sizeof(*part), flags);
 		if (!part)
 			return NULL;
 		if (!(flags & __GFP_ZERO))
diff --git a/lib/genalloc.c b/lib/genalloc.c
index 144fe6b1a03e..696cf1236b6c 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -153,7 +153,7 @@ struct gen_pool *gen_pool_create(int min_alloc_order, int nid)
 {
 	struct gen_pool *pool;
 
-	pool = kmalloc_node(sizeof(struct gen_pool), GFP_KERNEL, nid);
+	pool = kmalloc_node(sizeof(*pool), GFP_KERNEL, nid);
 	if (pool != NULL) {
 		spin_lock_init(&pool->lock);
 		INIT_LIST_HEAD(&pool->chunks);
diff --git a/lib/lru_cache.c b/lib/lru_cache.c
index 28ba40b99337..4882ed22a8ce 100644
--- a/lib/lru_cache.c
+++ b/lib/lru_cache.c
@@ -116,7 +116,7 @@ struct lru_cache *lc_create(const char *name, struct kmem_cache *cache,
 	if (e_count > LC_MAX_ACTIVE)
 		return NULL;
 
-	slot = kcalloc(e_count, sizeof(struct hlist_head), GFP_KERNEL);
+	slot = kcalloc(e_count, sizeof(*slot), GFP_KERNEL);
 	if (!slot)
 		goto out_fail;
 	element = kzalloc(e_count * sizeof(struct lc_element *), GFP_KERNEL);
diff --git a/lib/reed_solomon/reed_solomon.c b/lib/reed_solomon/reed_solomon.c
index 06d04cfa9339..2d0ec9f84322 100644
--- a/lib/reed_solomon/reed_solomon.c
+++ b/lib/reed_solomon/reed_solomon.c
@@ -70,7 +70,7 @@ static struct rs_control *rs_init(int symsize, int gfpoly, int (*gffunc)(int),
 	int i, j, sr, root, iprim;
 
 	/* Allocate the control structure */
-	rs = kmalloc(sizeof (struct rs_control), GFP_KERNEL);
+	rs = kmalloc(sizeof(*rs), GFP_KERNEL);
 	if (rs == NULL)
 		return NULL;
 
diff --git a/lib/test_kmod.c b/lib/test_kmod.c
index 337f408b4de6..57f3337f2482 100644
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -1086,7 +1086,7 @@ static struct kmod_test_device *alloc_test_dev_kmod(int idx)
 	struct kmod_test_device *test_dev;
 	struct miscdevice *misc_dev;
 
-	test_dev = vzalloc(sizeof(struct kmod_test_device));
+	test_dev = vzalloc(sizeof(*test_dev));
 	if (!test_dev)
 		goto err_out;
 
-- 
2.14.2

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 2/2] lib: Improve a size determination in seven functions
@ 2017-10-07 17:50   ` SF Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2017-10-07 17:50 UTC (permalink / raw)
  To: iommu, kasan-dev, Alexander Potapenko, Andrew Morton,
	Andrey Ryabinin, Andy Shevchenko, Christoph Hellwig,
	Daniel Mentz, Dmitry Vyukov, Geert Uytterhoeven, Lars Ellenberg,
	Luis R. Rodriguez, Marek Szyprowski, Mathieu Desnoyers,
	Philipp Reisner, Robin Murphy, Will Deacon
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 7 Oct 2017 19:19:45 +0200

Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 lib/dma-debug.c                 | 2 +-
 lib/flex_array.c                | 4 ++--
 lib/genalloc.c                  | 2 +-
 lib/lru_cache.c                 | 2 +-
 lib/reed_solomon/reed_solomon.c | 2 +-
 lib/test_kmod.c                 | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index ea4cc3dde4f1..8b5c8fc76f8a 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -993,7 +993,7 @@ void dma_debug_add_bus(struct bus_type *bus)
 	if (dma_debug_disabled())
 		return;
 
-	nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL);
+	nb = kzalloc(sizeof(*nb), GFP_KERNEL);
 	if (nb = NULL) {
 		pr_err("dma_debug_add_bus: out of memory\n");
 		return;
diff --git a/lib/flex_array.c b/lib/flex_array.c
index 2eed22fa507c..ebe0f366b6cb 100644
--- a/lib/flex_array.c
+++ b/lib/flex_array.c
@@ -102,7 +102,7 @@ struct flex_array *flex_array_alloc(int element_size, unsigned int total,
 	/* max_size will end up 0 if element_size > PAGE_SIZE */
 	if (total > max_size)
 		return NULL;
-	ret = kzalloc(sizeof(struct flex_array), flags);
+	ret = kzalloc(sizeof(*ret), flags);
 	if (!ret)
 		return NULL;
 	ret->element_size = element_size;
@@ -167,7 +167,7 @@ __fa_get_part(struct flex_array *fa, int part_nr, gfp_t flags)
 {
 	struct flex_array_part *part = fa->parts[part_nr];
 	if (!part) {
-		part = kmalloc(sizeof(struct flex_array_part), flags);
+		part = kmalloc(sizeof(*part), flags);
 		if (!part)
 			return NULL;
 		if (!(flags & __GFP_ZERO))
diff --git a/lib/genalloc.c b/lib/genalloc.c
index 144fe6b1a03e..696cf1236b6c 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -153,7 +153,7 @@ struct gen_pool *gen_pool_create(int min_alloc_order, int nid)
 {
 	struct gen_pool *pool;
 
-	pool = kmalloc_node(sizeof(struct gen_pool), GFP_KERNEL, nid);
+	pool = kmalloc_node(sizeof(*pool), GFP_KERNEL, nid);
 	if (pool != NULL) {
 		spin_lock_init(&pool->lock);
 		INIT_LIST_HEAD(&pool->chunks);
diff --git a/lib/lru_cache.c b/lib/lru_cache.c
index 28ba40b99337..4882ed22a8ce 100644
--- a/lib/lru_cache.c
+++ b/lib/lru_cache.c
@@ -116,7 +116,7 @@ struct lru_cache *lc_create(const char *name, struct kmem_cache *cache,
 	if (e_count > LC_MAX_ACTIVE)
 		return NULL;
 
-	slot = kcalloc(e_count, sizeof(struct hlist_head), GFP_KERNEL);
+	slot = kcalloc(e_count, sizeof(*slot), GFP_KERNEL);
 	if (!slot)
 		goto out_fail;
 	element = kzalloc(e_count * sizeof(struct lc_element *), GFP_KERNEL);
diff --git a/lib/reed_solomon/reed_solomon.c b/lib/reed_solomon/reed_solomon.c
index 06d04cfa9339..2d0ec9f84322 100644
--- a/lib/reed_solomon/reed_solomon.c
+++ b/lib/reed_solomon/reed_solomon.c
@@ -70,7 +70,7 @@ static struct rs_control *rs_init(int symsize, int gfpoly, int (*gffunc)(int),
 	int i, j, sr, root, iprim;
 
 	/* Allocate the control structure */
-	rs = kmalloc(sizeof (struct rs_control), GFP_KERNEL);
+	rs = kmalloc(sizeof(*rs), GFP_KERNEL);
 	if (rs = NULL)
 		return NULL;
 
diff --git a/lib/test_kmod.c b/lib/test_kmod.c
index 337f408b4de6..57f3337f2482 100644
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -1086,7 +1086,7 @@ static struct kmod_test_device *alloc_test_dev_kmod(int idx)
 	struct kmod_test_device *test_dev;
 	struct miscdevice *misc_dev;
 
-	test_dev = vzalloc(sizeof(struct kmod_test_device));
+	test_dev = vzalloc(sizeof(*test_dev));
 	if (!test_dev)
 		goto err_out;
 
-- 
2.14.2


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/2] lib: Adjustments for 11 function implementations
@ 2017-10-08  8:42   ` Christoph Hellwig
  0 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2017-10-08  8:42 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: iommu, kasan-dev, Alexander Potapenko, Andrew Morton,
	Andrey Ryabinin, Andy Shevchenko, Christoph Hellwig,
	Daniel Mentz, Dmitry Vyukov, Geert Uytterhoeven, Lars Ellenberg,
	Luis R. Rodriguez, Marek Szyprowski, Mathieu Desnoyers,
	Philipp Reisner, Robin Murphy, Will Deacon, LKML,
	kernel-janitors

Please stop sending this crap.  It's a move from one preference to
another slightly different one.  You are free to apply your preference
if you do a major overhaul of some code (subject to maintainer approval),
but without that they simply are churn.

NAK for both patches.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/2] lib: Adjustments for 11 function implementations
@ 2017-10-08  8:42   ` Christoph Hellwig
  0 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2017-10-08  8:42 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Lars Ellenberg, LKML,
	Philipp Reisner, Will Deacon, Luis R. Rodriguez,
	kasan-dev-/JYPxA39Uh5TLH3MbocFFw, Geert Uytterhoeven,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Alexander Potapenko, Daniel Mentz, Mathieu Desnoyers,
	Andrey Ryabinin, Andrew Morton, Andy Shevchenko,
	Christoph Hellwig, Dmitry Vyukov

Please stop sending this crap.  It's a move from one preference to
another slightly different one.  You are free to apply your preference
if you do a major overhaul of some code (subject to maintainer approval),
but without that they simply are churn.

NAK for both patches.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/2] lib: Adjustments for 11 function implementations
@ 2017-10-08  8:42   ` Christoph Hellwig
  0 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2017-10-08  8:42 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Lars Ellenberg, LKML,
	Philipp Reisner, Will Deacon, Luis R. Rodriguez,
	kasan-dev-/JYPxA39Uh5TLH3MbocFFw, Geert Uytterhoeven,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Alexander Potapenko, Daniel Mentz, Mathieu Desnoyers,
	Andrey Ryabinin, Andrew Morton, Andy Shevchenko,
	Christoph Hellwig, Dmitry Vyukov

Please stop sending this crap.  It's a move from one preference to
another slightly different one.  You are free to apply your preference
if you do a major overhaul of some code (subject to maintainer approval),
but without that they simply are churn.

NAK for both patches.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] lib: Improve a size determination in seven functions
  2017-10-07 17:50   ` SF Markus Elfring
@ 2017-10-08 10:49     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 16+ messages in thread
From: Geert Uytterhoeven @ 2017-10-08 10:49 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: iommu, kasan-dev, Alexander Potapenko, Andrew Morton,
	Andrey Ryabinin, Andy Shevchenko, Christoph Hellwig,
	Daniel Mentz, Dmitry Vyukov, Lars Ellenberg, Luis R. Rodriguez,
	Marek Szyprowski, Mathieu Desnoyers, Philipp Reisner,
	Robin Murphy, Will Deacon, LKML, kernel-janitors

On Sat, Oct 7, 2017 at 7:50 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 7 Oct 2017 19:19:45 +0200
>
> Replace the specification of data structures by pointer dereferences
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer according to the Linux coding style convention.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] lib: Improve a size determination in seven functions
@ 2017-10-08 10:49     ` Geert Uytterhoeven
  0 siblings, 0 replies; 16+ messages in thread
From: Geert Uytterhoeven @ 2017-10-08 10:49 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: iommu, kasan-dev, Alexander Potapenko, Andrew Morton,
	Andrey Ryabinin, Andy Shevchenko, Christoph Hellwig,
	Daniel Mentz, Dmitry Vyukov, Lars Ellenberg, Luis R. Rodriguez,
	Marek Szyprowski, Mathieu Desnoyers, Philipp Reisner,
	Robin Murphy, Will Deacon, LKML, kernel-janitors

On Sat, Oct 7, 2017 at 7:50 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 7 Oct 2017 19:19:45 +0200
>
> Replace the specification of data structures by pointer dereferences
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer according to the Linux coding style convention.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/2] lib: Adjustments for 11 function implementations
@ 2017-10-08 14:21     ` Andy Shevchenko
  0 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2017-10-08 14:21 UTC (permalink / raw)
  To: Christoph Hellwig, SF Markus Elfring
  Cc: iommu, kasan-dev, Alexander Potapenko, Andrew Morton,
	Andrey Ryabinin, Daniel Mentz, Dmitry Vyukov, Geert Uytterhoeven,
	Lars Ellenberg, Luis R. Rodriguez, Marek Szyprowski,
	Mathieu Desnoyers, Philipp Reisner, Robin Murphy, Will Deacon,
	LKML, kernel-janitors

On Sun, 2017-10-08 at 10:42 +0200, Christoph Hellwig wrote:
> Please stop sending this crap.  It's a move from one preference to
> another slightly different one.  You are free to apply your preference
> if you do a major overhaul of some code (subject to maintainer
> approval),
> but without that they simply are churn.
> 
> NAK for both patches.

While patch 1 might have some sense, second one is matter of taste which
is dependent to maintainer/trends/weather on Mars.

So, +1 to Christoph's opinion.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/2] lib: Adjustments for 11 function implementations
@ 2017-10-08 14:21     ` Andy Shevchenko
  0 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2017-10-08 14:21 UTC (permalink / raw)
  To: Christoph Hellwig, SF Markus Elfring
  Cc: kernel-janitors-u79uwXL29TY76Z2rM5mHXA, LKML, Will Deacon,
	Luis R. Rodriguez, kasan-dev-/JYPxA39Uh5TLH3MbocFFw,
	Geert Uytterhoeven,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Alexander Potapenko, Daniel Mentz, Mathieu Desnoyers,
	Andrey Ryabinin, Andrew Morton, Philipp Reisner, Lars Ellenberg,
	Dmitry Vyukov

On Sun, 2017-10-08 at 10:42 +0200, Christoph Hellwig wrote:
> Please stop sending this crap.  It's a move from one preference to
> another slightly different one.  You are free to apply your preference
> if you do a major overhaul of some code (subject to maintainer
> approval),
> but without that they simply are churn.
> 
> NAK for both patches.

While patch 1 might have some sense, second one is matter of taste which
is dependent to maintainer/trends/weather on Mars.

So, +1 to Christoph's opinion.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/2] lib: Adjustments for 11 function implementations
@ 2017-10-08 14:21     ` Andy Shevchenko
  0 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2017-10-08 14:21 UTC (permalink / raw)
  To: Christoph Hellwig, SF Markus Elfring
  Cc: kernel-janitors-u79uwXL29TY76Z2rM5mHXA, LKML, Will Deacon,
	Luis R. Rodriguez, kasan-dev-/JYPxA39Uh5TLH3MbocFFw,
	Geert Uytterhoeven,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Alexander Potapenko, Daniel Mentz, Mathieu Desnoyers,
	Andrey Ryabinin, Andrew Morton, Philipp Reisner, Lars Ellenberg,
	Dmitry Vyukov

On Sun, 2017-10-08 at 10:42 +0200, Christoph Hellwig wrote:
> Please stop sending this crap.  It's a move from one preference to
> another slightly different one.  You are free to apply your preference
> if you do a major overhaul of some code (subject to maintainer
> approval),
> but without that they simply are churn.
> 
> NAK for both patches.

While patch 1 might have some sense, second one is matter of taste which
is dependent to maintainer/trends/weather on Mars.

So, +1 to Christoph's opinion.

-- 
Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] lib/test: Delete five error messages for a failed memory allocation
  2017-10-07 17:48   ` SF Markus Elfring
@ 2017-10-09  6:24     ` Michal Hocko
  -1 siblings, 0 replies; 16+ messages in thread
From: Michal Hocko @ 2017-10-09  6:24 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: iommu, kasan-dev, Alexander Potapenko, Andrew Morton,
	Andrey Ryabinin, Andy Shevchenko, Christoph Hellwig,
	Daniel Mentz, Dmitry Vyukov, Geert Uytterhoeven, Lars Ellenberg,
	Luis R. Rodriguez, Marek Szyprowski, Mathieu Desnoyers,
	Philipp Reisner, Robin Murphy, Will Deacon, LKML,
	kernel-janitors

On Sat 07-10-17 19:48:37, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 7 Oct 2017 17:34:23 +0200
> 
> Omit extra messages for a memory allocation failure in these functions.
> 
> This issue was detected by using the Coccinelle software.

Yes this makes sense. None of those really explain what the allocation
failure effect is. The allocation path already tells us about the
failure enough.

> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  lib/test_kasan.c     | 5 ++---
>  lib/test_kmod.c      | 8 ++------
>  lib/test_list_sort.c | 9 +++------
>  3 files changed, 7 insertions(+), 15 deletions(-)
> 
> diff --git a/lib/test_kasan.c b/lib/test_kasan.c
> index a25c9763fce1..ef1a3ac1397e 100644
> --- a/lib/test_kasan.c
> +++ b/lib/test_kasan.c
> @@ -353,10 +353,9 @@ static noinline void __init memcg_accounted_kmem_cache(void)
>  	 */
>  	for (i = 0; i < 5; i++) {
>  		p = kmem_cache_alloc(cache, GFP_KERNEL);
> -		if (!p) {
> -			pr_err("Allocation failed\n");
> +		if (!p)
>  			goto free_cache;
> -		}
> +
>  		kmem_cache_free(cache, p);
>  		msleep(100);
>  	}
> diff --git a/lib/test_kmod.c b/lib/test_kmod.c
> index fba78d25e825..337f408b4de6 100644
> --- a/lib/test_kmod.c
> +++ b/lib/test_kmod.c
> @@ -783,10 +783,8 @@ static int kmod_config_sync_info(struct kmod_test_device *test_dev)
>  	free_test_dev_info(test_dev);
>  	test_dev->info = vzalloc(config->num_threads *
>  				 sizeof(struct kmod_test_device_info));
> -	if (!test_dev->info) {
> -		dev_err(test_dev->dev, "Cannot alloc test_dev info\n");
> +	if (!test_dev->info)
>  		return -ENOMEM;
> -	}
>  
>  	return 0;
>  }
> @@ -1089,10 +1087,8 @@ static struct kmod_test_device *alloc_test_dev_kmod(int idx)
>  	struct miscdevice *misc_dev;
>  
>  	test_dev = vzalloc(sizeof(struct kmod_test_device));
> -	if (!test_dev) {
> -		pr_err("Cannot alloc test_dev\n");
> +	if (!test_dev)
>  		goto err_out;
> -	}
>  
>  	mutex_init(&test_dev->config_mutex);
>  	mutex_init(&test_dev->trigger_mutex);
> diff --git a/lib/test_list_sort.c b/lib/test_list_sort.c
> index 28e817387b04..5474f3f3e41d 100644
> --- a/lib/test_list_sort.c
> +++ b/lib/test_list_sort.c
> @@ -76,17 +76,14 @@ static int __init list_sort_test(void)
>  	pr_debug("start testing list_sort()\n");
>  
>  	elts = kcalloc(TEST_LIST_LEN, sizeof(*elts), GFP_KERNEL);
> -	if (!elts) {
> -		pr_err("error: cannot allocate memory\n");
> +	if (!elts)
>  		return err;
> -	}
>  
>  	for (i = 0; i < TEST_LIST_LEN; i++) {
>  		el = kmalloc(sizeof(*el), GFP_KERNEL);
> -		if (!el) {
> -			pr_err("error: cannot allocate memory\n");
> +		if (!el)
>  			goto exit;
> -		}
> +
>  		 /* force some equivalencies */
>  		el->value = prandom_u32() % (TEST_LIST_LEN / 3);
>  		el->serial = i;
> -- 
> 2.14.2

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] lib/test: Delete five error messages for a failed memory allocation
@ 2017-10-09  6:24     ` Michal Hocko
  0 siblings, 0 replies; 16+ messages in thread
From: Michal Hocko @ 2017-10-09  6:24 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: iommu, kasan-dev, Alexander Potapenko, Andrew Morton,
	Andrey Ryabinin, Andy Shevchenko, Christoph Hellwig,
	Daniel Mentz, Dmitry Vyukov, Geert Uytterhoeven, Lars Ellenberg,
	Luis R. Rodriguez, Marek Szyprowski, Mathieu Desnoyers,
	Philipp Reisner, Robin Murphy, Will Deacon, LKML,
	kernel-janitors

On Sat 07-10-17 19:48:37, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 7 Oct 2017 17:34:23 +0200
> 
> Omit extra messages for a memory allocation failure in these functions.
> 
> This issue was detected by using the Coccinelle software.

Yes this makes sense. None of those really explain what the allocation
failure effect is. The allocation path already tells us about the
failure enough.

> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  lib/test_kasan.c     | 5 ++---
>  lib/test_kmod.c      | 8 ++------
>  lib/test_list_sort.c | 9 +++------
>  3 files changed, 7 insertions(+), 15 deletions(-)
> 
> diff --git a/lib/test_kasan.c b/lib/test_kasan.c
> index a25c9763fce1..ef1a3ac1397e 100644
> --- a/lib/test_kasan.c
> +++ b/lib/test_kasan.c
> @@ -353,10 +353,9 @@ static noinline void __init memcg_accounted_kmem_cache(void)
>  	 */
>  	for (i = 0; i < 5; i++) {
>  		p = kmem_cache_alloc(cache, GFP_KERNEL);
> -		if (!p) {
> -			pr_err("Allocation failed\n");
> +		if (!p)
>  			goto free_cache;
> -		}
> +
>  		kmem_cache_free(cache, p);
>  		msleep(100);
>  	}
> diff --git a/lib/test_kmod.c b/lib/test_kmod.c
> index fba78d25e825..337f408b4de6 100644
> --- a/lib/test_kmod.c
> +++ b/lib/test_kmod.c
> @@ -783,10 +783,8 @@ static int kmod_config_sync_info(struct kmod_test_device *test_dev)
>  	free_test_dev_info(test_dev);
>  	test_dev->info = vzalloc(config->num_threads *
>  				 sizeof(struct kmod_test_device_info));
> -	if (!test_dev->info) {
> -		dev_err(test_dev->dev, "Cannot alloc test_dev info\n");
> +	if (!test_dev->info)
>  		return -ENOMEM;
> -	}
>  
>  	return 0;
>  }
> @@ -1089,10 +1087,8 @@ static struct kmod_test_device *alloc_test_dev_kmod(int idx)
>  	struct miscdevice *misc_dev;
>  
>  	test_dev = vzalloc(sizeof(struct kmod_test_device));
> -	if (!test_dev) {
> -		pr_err("Cannot alloc test_dev\n");
> +	if (!test_dev)
>  		goto err_out;
> -	}
>  
>  	mutex_init(&test_dev->config_mutex);
>  	mutex_init(&test_dev->trigger_mutex);
> diff --git a/lib/test_list_sort.c b/lib/test_list_sort.c
> index 28e817387b04..5474f3f3e41d 100644
> --- a/lib/test_list_sort.c
> +++ b/lib/test_list_sort.c
> @@ -76,17 +76,14 @@ static int __init list_sort_test(void)
>  	pr_debug("start testing list_sort()\n");
>  
>  	elts = kcalloc(TEST_LIST_LEN, sizeof(*elts), GFP_KERNEL);
> -	if (!elts) {
> -		pr_err("error: cannot allocate memory\n");
> +	if (!elts)
>  		return err;
> -	}
>  
>  	for (i = 0; i < TEST_LIST_LEN; i++) {
>  		el = kmalloc(sizeof(*el), GFP_KERNEL);
> -		if (!el) {
> -			pr_err("error: cannot allocate memory\n");
> +		if (!el)
>  			goto exit;
> -		}
> +
>  		 /* force some equivalencies */
>  		el->value = prandom_u32() % (TEST_LIST_LEN / 3);
>  		el->serial = i;
> -- 
> 2.14.2

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-10-09  6:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-07 17:46 [PATCH 0/2] lib: Adjustments for 11 function implementations SF Markus Elfring
2017-10-07 17:46 ` SF Markus Elfring
2017-10-07 17:48 ` [PATCH 1/2] lib/test: Delete five error messages for a failed memory allocation SF Markus Elfring
2017-10-07 17:48   ` SF Markus Elfring
2017-10-09  6:24   ` Michal Hocko
2017-10-09  6:24     ` Michal Hocko
2017-10-07 17:50 ` [PATCH 2/2] lib: Improve a size determination in seven functions SF Markus Elfring
2017-10-07 17:50   ` SF Markus Elfring
2017-10-08 10:49   ` Geert Uytterhoeven
2017-10-08 10:49     ` Geert Uytterhoeven
2017-10-08  8:42 ` [PATCH 0/2] lib: Adjustments for 11 function implementations Christoph Hellwig
2017-10-08  8:42   ` Christoph Hellwig
2017-10-08  8:42   ` Christoph Hellwig
2017-10-08 14:21   ` Andy Shevchenko
2017-10-08 14:21     ` Andy Shevchenko
2017-10-08 14:21     ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.