All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm thin: fix using the correct variable for sizeof()
@ 2022-03-19 20:18 ` Jakob Koschel
  0 siblings, 0 replies; 2+ messages in thread
From: Jakob Koschel @ 2022-03-19 20:18 UTC (permalink / raw)
  To: Alasdair Kergon
  Cc: Jakob Koschel, linux-kernel, dm-devel, Mike Snitzer,
	Mike Rapoport, Brian Johannesmeyer, Cristiano Giuffrida, Bos,
	H.J.

While the original code is valid, it is not the obvious choice for the
sizeof() call and in preparation to limit the scope of the list iterator
variable the sizeof should be changed to the size of the array
elements that are beings sorted.

Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
---
 drivers/md/dm-thin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index ec119d2422d5..2e41e50d6903 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -2251,7 +2251,7 @@ static unsigned sort_cells(struct pool *pool, struct list_head *cells)
 		list_del(&cell->user_list);
 	}

-	sort(pool->cell_sort_array, count, sizeof(cell), cmp_cells, NULL);
+	sort(pool->cell_sort_array, count, sizeof(*pool->cell_sort_array), cmp_cells, NULL);

 	return count;
 }

base-commit: 34e047aa16c0123bbae8e2f6df33e5ecc1f56601
--
2.25.1


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

* [dm-devel] [PATCH] dm thin: fix using the correct variable for sizeof()
@ 2022-03-19 20:18 ` Jakob Koschel
  0 siblings, 0 replies; 2+ messages in thread
From: Jakob Koschel @ 2022-03-19 20:18 UTC (permalink / raw)
  To: Alasdair Kergon
  Cc: Cristiano Giuffrida, Mike Snitzer, linux-kernel, Bos, H.J.,
	Brian Johannesmeyer, dm-devel, Jakob Koschel, Mike Rapoport

While the original code is valid, it is not the obvious choice for the
sizeof() call and in preparation to limit the scope of the list iterator
variable the sizeof should be changed to the size of the array
elements that are beings sorted.

Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
---
 drivers/md/dm-thin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index ec119d2422d5..2e41e50d6903 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -2251,7 +2251,7 @@ static unsigned sort_cells(struct pool *pool, struct list_head *cells)
 		list_del(&cell->user_list);
 	}

-	sort(pool->cell_sort_array, count, sizeof(cell), cmp_cells, NULL);
+	sort(pool->cell_sort_array, count, sizeof(*pool->cell_sort_array), cmp_cells, NULL);

 	return count;
 }

base-commit: 34e047aa16c0123bbae8e2f6df33e5ecc1f56601
--
2.25.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


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

end of thread, other threads:[~2022-03-21  6:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-19 20:18 [PATCH] dm thin: fix using the correct variable for sizeof() Jakob Koschel
2022-03-19 20:18 ` [dm-devel] " Jakob Koschel

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.