All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakob Koschel <jakobkoschel@gmail.com>
To: Alasdair Kergon <agk@redhat.com>
Cc: Jakob Koschel <jakobkoschel@gmail.com>,
	linux-kernel@vger.kernel.org, dm-devel@redhat.com,
	Mike Snitzer <snitzer@redhat.com>,
	Mike Rapoport <rppt@kernel.org>,
	"Brian Johannesmeyer" <bjohannesmeyer@gmail.com>,
	Cristiano Giuffrida <c.giuffrida@vu.nl>,
	"Bos, H.J." <h.j.bos@vu.nl>
Subject: [PATCH] dm thin: fix using the correct variable for sizeof()
Date: Sat, 19 Mar 2022 21:18:11 +0100	[thread overview]
Message-ID: <20220319201811.2515178-1-jakobkoschel@gmail.com> (raw)

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


WARNING: multiple messages have this Message-ID (diff)
From: Jakob Koschel <jakobkoschel@gmail.com>
To: Alasdair Kergon <agk@redhat.com>
Cc: Cristiano Giuffrida <c.giuffrida@vu.nl>,
	Mike Snitzer <snitzer@redhat.com>,
	linux-kernel@vger.kernel.org, "Bos, H.J." <h.j.bos@vu.nl>,
	Brian Johannesmeyer <bjohannesmeyer@gmail.com>,
	dm-devel@redhat.com, Jakob Koschel <jakobkoschel@gmail.com>,
	Mike Rapoport <rppt@kernel.org>
Subject: [dm-devel] [PATCH] dm thin: fix using the correct variable for sizeof()
Date: Sat, 19 Mar 2022 21:18:11 +0100	[thread overview]
Message-ID: <20220319201811.2515178-1-jakobkoschel@gmail.com> (raw)

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


             reply	other threads:[~2022-03-19 20:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-19 20:18 Jakob Koschel [this message]
2022-03-19 20:18 ` [dm-devel] [PATCH] dm thin: fix using the correct variable for sizeof() Jakob Koschel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220319201811.2515178-1-jakobkoschel@gmail.com \
    --to=jakobkoschel@gmail.com \
    --cc=agk@redhat.com \
    --cc=bjohannesmeyer@gmail.com \
    --cc=c.giuffrida@vu.nl \
    --cc=dm-devel@redhat.com \
    --cc=h.j.bos@vu.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rppt@kernel.org \
    --cc=snitzer@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.