All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] bitmap: fix conversion from/to fix-sized arrays
@ 2022-04-28 20:51 Yury Norov
  2022-04-28 20:51 ` [PATCH 1/5] lib/bitmap: extend comment for bitmap_(from,to)_arr32() Yury Norov
                   ` (4 more replies)
  0 siblings, 5 replies; 24+ messages in thread
From: Yury Norov @ 2022-04-28 20:51 UTC (permalink / raw)
  To: linux-kernel, Alexander Gordeev, Andy Shevchenko,
	Christian Borntraeger, Claudio Imbrenda, David Hildenbrand,
	Heiko Carstens, Janosch Frank, Rasmus Villemoes, Sven Schnelle,
	Vasily Gorbik, Yury Norov, linux-s390, kvm

In the kernel codebase we have functions that call bitmap_copy()
to convert bitmaps to and from fix-sized 32 or 64-bit arrays. It
works well for LE architectures when size of long is equal to the
size of fixed type.

If the system is BE and/or size of long is not equal to the size of
fixed type of the array, bitmap_copy() may produce wrong result either
because of endianness issue, or because of out-of-bound access.

To address this problem we have bitmap_{from,to}_arr32(). In recent
discussion it was spotted that we also need 64-bit analogue:

https://lore.kernel.org/all/YiCWNdWd+AsLbDkp@smile.fi.intel.com/T/#m754da92acb0003e12b99293d07ddcd46dbe04ada

This series takes care of it.

v1: https://lore.kernel.org/lkml/20220420222530.910125-3-yury.norov@gmail.com/T/
v2: - fix build warnings (patch 2)
    - add test for bitmap_{from,to}_arr64

Yury Norov (5):
  lib/bitmap: extend comment for bitmap_(from,to)_arr32()
  lib: add bitmap_{from,to}_arr64
  lib/bitmap: add test for bitmap_{from,to}_arr64
  KVM: s390: replace bitmap_copy with bitmap_{from,to}_arr64 where
    appropriate
  drm/amd/pm: use bitmap_{from,to}_arr32 where appropriate

 arch/s390/kvm/kvm-s390.c                      | 10 ++--
 .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    |  2 +-
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    |  2 +-
 include/linux/bitmap.h                        | 31 +++++++++---
 lib/bitmap.c                                  | 48 +++++++++++++++++++
 lib/test_bitmap.c                             | 25 ++++++++++
 6 files changed, 103 insertions(+), 15 deletions(-)

-- 
2.32.0


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

end of thread, other threads:[~2023-02-27 20:23 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28 20:51 [PATCH v2 0/5] bitmap: fix conversion from/to fix-sized arrays Yury Norov
2022-04-28 20:51 ` [PATCH 1/5] lib/bitmap: extend comment for bitmap_(from,to)_arr32() Yury Norov
2022-04-28 20:51 ` [PATCH 2/5] lib: add bitmap_{from,to}_arr64 Yury Norov
2022-04-29 12:59   ` Andy Shevchenko
2022-04-29 15:45     ` Yury Norov
2022-05-02 20:06       ` Yury Norov
2022-05-03  9:56         ` Andy Shevchenko
2022-04-28 20:51 ` [PATCH 3/5] lib/bitmap: add test for bitmap_{from,to}_arr64 Yury Norov
2022-05-19 15:09   ` Guenter Roeck
2022-05-19 16:01     ` Yury Norov
2022-05-19 18:04       ` Guenter Roeck
2022-05-20 16:18         ` Yury Norov
2022-05-21  7:38     ` Yury Norov
2023-02-25 18:47   ` Guenter Roeck
2023-02-26  0:04     ` Yury Norov
2023-02-26  0:06       ` Yury Norov
2023-02-27 14:46         ` Alexander Lobakin
2023-02-27 14:59           ` Guenter Roeck
2023-02-27 19:24             ` Yury Norov
2023-02-27 20:12               ` Guenter Roeck
2023-02-27 20:23                 ` Yury Norov
2023-02-26  0:42       ` Guenter Roeck
2022-04-28 20:51 ` [PATCH 4/5] KVM: s390: replace bitmap_copy with bitmap_{from,to}_arr64 where appropriate Yury Norov
2022-04-28 20:51 ` [PATCH 5/5] drm/amd/pm: use bitmap_{from,to}_arr32 " Yury Norov

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.