From a06702861dc0ae7f69bc552a3ede7ed6bb4ebbb1 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Mon, 25 Jul 2022 14:15:16 -0400 Subject: [PATCH] Fixes for 5.10 Signed-off-by: Sasha Levin --- ...-type-of-reg-too-small-for-mask-test.patch | 63 +++++++++++++++++++ ...nding-remove-if-msg-allocation-fails.patch | 47 ++++++++++++++ ...fix-unused-but-set-variable-warnings.patch | 53 ++++++++++++++++ queue-5.10/series | 3 + 4 files changed, 166 insertions(+) create mode 100644 queue-5.10/bitfield.h-fix-type-of-reg-too-small-for-mask-test.patch create mode 100644 queue-5.10/dlm-fix-pending-remove-if-msg-allocation-fails.patch create mode 100644 queue-5.10/drm-imx-dcss-fix-unused-but-set-variable-warnings.patch diff --git a/queue-5.10/bitfield.h-fix-type-of-reg-too-small-for-mask-test.patch b/queue-5.10/bitfield.h-fix-type-of-reg-too-small-for-mask-test.patch new file mode 100644 index 00000000000..768d6b973a2 --- /dev/null +++ b/queue-5.10/bitfield.h-fix-type-of-reg-too-small-for-mask-test.patch @@ -0,0 +1,63 @@ +From 2386d2f0153e353b4a1169e04d6903b84ce2a185 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 10 Nov 2021 11:01:03 +0100 +Subject: bitfield.h: Fix "type of reg too small for mask" test + +From: Peter Zijlstra + +[ Upstream commit bff8c3848e071d387d8b0784dc91fa49cd563774 ] + +The test: 'mask > (typeof(_reg))~0ull' only works correctly when both +sides are unsigned, consider: + + - 0xff000000 vs (int)~0ull + - 0x000000ff vs (int)~0ull + +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Josh Poimboeuf +Link: https://lore.kernel.org/r/20211110101324.950210584@infradead.org +Signed-off-by: Sasha Levin +--- + include/linux/bitfield.h | 19 ++++++++++++++++++- + 1 file changed, 18 insertions(+), 1 deletion(-) + +diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h +index 4e035aca6f7e..6093fa6db260 100644 +--- a/include/linux/bitfield.h ++++ b/include/linux/bitfield.h +@@ -41,6 +41,22 @@ + + #define __bf_shf(x) (__builtin_ffsll(x) - 1) + ++#define __scalar_type_to_unsigned_cases(type) \ ++ unsigned type: (unsigned type)0, \ ++ signed type: (unsigned type)0 ++ ++#define __unsigned_scalar_typeof(x) typeof( \ ++ _Generic((x), \ ++ char: (unsigned char)0, \ ++ __scalar_type_to_unsigned_cases(char), \ ++ __scalar_type_to_unsigned_cases(short), \ ++ __scalar_type_to_unsigned_cases(int), \ ++ __scalar_type_to_unsigned_cases(long), \ ++ __scalar_type_to_unsigned_cases(long long), \ ++ default: (x))) ++ ++#define __bf_cast_unsigned(type, x) ((__unsigned_scalar_typeof(type))(x)) ++ + #define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx) \ + ({ \ + BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \ +@@ -49,7 +65,8 @@ + BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \ + ~((_mask) >> __bf_shf(_mask)) & (_val) : 0, \ + _pfx "value too large for the field"); \ +- BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \ ++ BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \ ++ __bf_cast_unsigned(_reg, ~0ull), \ + _pfx "type of reg too small for mask"); \ + __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) + \ + (1ULL << __bf_shf(_mask))); \ +-- +2.35.1 + diff --git a/queue-5.10/dlm-fix-pending-remove-if-msg-allocation-fails.patch b/queue-5.10/dlm-fix-pending-remove-if-msg-allocation-fails.patch new file mode 100644 index 00000000000..d0addd77d46 --- /dev/null +++ b/queue-5.10/dlm-fix-pending-remove-if-msg-allocation-fails.patch @@ -0,0 +1,47 @@ +From 8379db8a788eed1cba967e07a5287e78fab423ef Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Apr 2022 13:34:16 -0400 +Subject: dlm: fix pending remove if msg allocation fails + +From: Alexander Aring + +[ Upstream commit ba58995909b5098ca4003af65b0ccd5a8d13dd25 ] + +This patch unsets ls_remove_len and ls_remove_name if a message +allocation of a remove messages fails. In this case we never send a +remove message out but set the per ls ls_remove_len ls_remove_name +variable for a pending remove. Unset those variable should indicate +possible waiters in wait_pending_remove() that no pending remove is +going on at this moment. + +Cc: stable@vger.kernel.org +Signed-off-by: Alexander Aring +Signed-off-by: David Teigland +Signed-off-by: Sasha Levin +--- + fs/dlm/lock.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c +index 2ce96a9ce63c..eaa28d654e9f 100644 +--- a/fs/dlm/lock.c ++++ b/fs/dlm/lock.c +@@ -4067,13 +4067,14 @@ static void send_repeat_remove(struct dlm_ls *ls, char *ms_name, int len) + rv = _create_message(ls, sizeof(struct dlm_message) + len, + dir_nodeid, DLM_MSG_REMOVE, &ms, &mh); + if (rv) +- return; ++ goto out; + + memcpy(ms->m_extra, name, len); + ms->m_hash = hash; + + send_message(mh, ms); + ++out: + spin_lock(&ls->ls_remove_spin); + ls->ls_remove_len = 0; + memset(ls->ls_remove_name, 0, DLM_RESNAME_MAXLEN); +-- +2.35.1 + diff --git a/queue-5.10/drm-imx-dcss-fix-unused-but-set-variable-warnings.patch b/queue-5.10/drm-imx-dcss-fix-unused-but-set-variable-warnings.patch new file mode 100644 index 00000000000..9110d128a71 --- /dev/null +++ b/queue-5.10/drm-imx-dcss-fix-unused-but-set-variable-warnings.patch @@ -0,0 +1,53 @@ +From b6c82bf05a530b41e8149cbbce52765e905f4b9a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 11 Sep 2020 09:44:14 +0800 +Subject: drm/imx/dcss: fix unused but set variable warnings +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Wang ShaoBo + +[ Upstream commit 523be44c334bc4e4c014032738dc277b8909d009 ] + +Fix unused but set variable warning building with `make W=1`: + +drivers/gpu/drm/imx/dcss/dcss-plane.c:270:6: warning: + variable ‘pixel_format’ set but not used [-Wunused-but-set-variable] + u32 pixel_format; + ^~~~~~~~~~~~ + +Fixes: 9021c317b770 ("drm/imx: Add initial support for DCSS on iMX8MQ") +Reported-by: Hulk Robot +Signed-off-by: Wang ShaoBo +Reviewed-by: Laurentiu Palcu +Signed-off-by: Lucas Stach +Link: https://patchwork.freedesktop.org/patch/msgid/20200911014414.4663-1-bobo.shaobowang@huawei.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/imx/dcss/dcss-plane.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/gpu/drm/imx/dcss/dcss-plane.c b/drivers/gpu/drm/imx/dcss/dcss-plane.c +index f54087ac44d3..46a188dd02ad 100644 +--- a/drivers/gpu/drm/imx/dcss/dcss-plane.c ++++ b/drivers/gpu/drm/imx/dcss/dcss-plane.c +@@ -268,7 +268,6 @@ static void dcss_plane_atomic_update(struct drm_plane *plane, + struct dcss_plane *dcss_plane = to_dcss_plane(plane); + struct dcss_dev *dcss = plane->dev->dev_private; + struct drm_framebuffer *fb = state->fb; +- u32 pixel_format; + struct drm_crtc_state *crtc_state; + bool modifiers_present; + u32 src_w, src_h, dst_w, dst_h; +@@ -279,7 +278,6 @@ static void dcss_plane_atomic_update(struct drm_plane *plane, + if (!fb || !state->crtc || !state->visible) + return; + +- pixel_format = state->fb->format->format; + crtc_state = state->crtc->state; + modifiers_present = !!(fb->flags & DRM_MODE_FB_MODIFIERS); + +-- +2.35.1 + diff --git a/queue-5.10/series b/queue-5.10/series index c6145d4ef37..900f83238a2 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -80,3 +80,6 @@ mm-mempolicy-fix-uninit-value-in-mpol_rebind_policy.patch bpf-make-sure-mac_header-was-set-before-using-it.patch sched-deadline-fix-bug_on-condition-for-deboosted-tasks.patch x86-bugs-warn-when-ibrs-mitigation-is-selected-on-enhanced-ibrs-parts.patch +dlm-fix-pending-remove-if-msg-allocation-fails.patch +drm-imx-dcss-fix-unused-but-set-variable-warnings.patch +bitfield.h-fix-type-of-reg-too-small-for-mask-test.patch -- 2.47.3