From: Greg Kroah-Hartman Date: Thu, 12 May 2022 13:45:34 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v4.9.314~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c8054e92bd0b8e1f4d5ccf13aea2ff2222c4a77c;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: block-drbd-drbd_nl-make-conversion-to-enum-drbd_ret_code-explicit.patch can-grcan-grcan_probe-fix-broken-system-id-check-for-errata-workaround-needs.patch can-grcan-only-use-the-napi-poll-budget-for-rx.patch drm-amd-display-dc-gpio-gpio_service-pass-around-correct-dce_-version-environment-types.patch drm-i915-cast-remain-to-unsigned-long-in-eb_relocate_vma.patch mips-use-address-of-operator-on-section-symbols.patch nfp-bpf-silence-bitwise-vs.-logical-or-warning.patch --- diff --git a/queue-5.4/block-drbd-drbd_nl-make-conversion-to-enum-drbd_ret_code-explicit.patch b/queue-5.4/block-drbd-drbd_nl-make-conversion-to-enum-drbd_ret_code-explicit.patch new file mode 100644 index 00000000000..59295aef1f1 --- /dev/null +++ b/queue-5.4/block-drbd-drbd_nl-make-conversion-to-enum-drbd_ret_code-explicit.patch @@ -0,0 +1,83 @@ +From 1f1e87b4dc4598eac57a69868534b92d65e47e82 Mon Sep 17 00:00:00 2001 +From: Lee Jones +Date: Fri, 12 Mar 2021 10:55:26 +0000 +Subject: block: drbd: drbd_nl: Make conversion to 'enum drbd_ret_code' explicit +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Lee Jones + +commit 1f1e87b4dc4598eac57a69868534b92d65e47e82 upstream. + +Fixes the following W=1 kernel build warning(s): + + from drivers/block/drbd/drbd_nl.c:24: + drivers/block/drbd/drbd_nl.c: In function ‘drbd_adm_set_role’: + drivers/block/drbd/drbd_nl.c:793:11: warning: implicit conversion from ‘enum drbd_state_rv’ to ‘enum drbd_ret_code’ [-Wenum-conversion] + drivers/block/drbd/drbd_nl.c:795:11: warning: implicit conversion from ‘enum drbd_state_rv’ to ‘enum drbd_ret_code’ [-Wenum-conversion] + drivers/block/drbd/drbd_nl.c: In function ‘drbd_adm_attach’: + drivers/block/drbd/drbd_nl.c:1965:10: warning: implicit conversion from ‘enum drbd_state_rv’ to ‘enum drbd_ret_code’ [-Wenum-conversion] + drivers/block/drbd/drbd_nl.c: In function ‘drbd_adm_connect’: + drivers/block/drbd/drbd_nl.c:2690:10: warning: implicit conversion from ‘enum drbd_state_rv’ to ‘enum drbd_ret_code’ [-Wenum-conversion] + drivers/block/drbd/drbd_nl.c: In function ‘drbd_adm_disconnect’: + drivers/block/drbd/drbd_nl.c:2803:11: warning: implicit conversion from ‘enum drbd_state_rv’ to ‘enum drbd_ret_code’ [-Wenum-conversion] + +Cc: Philipp Reisner +Cc: Lars Ellenberg +Cc: Jens Axboe +Cc: drbd-dev@lists.linbit.com +Cc: linux-block@vger.kernel.org +Signed-off-by: Lee Jones +Link: https://lore.kernel.org/r/20210312105530.2219008-8-lee.jones@linaro.org +Signed-off-by: Jens Axboe +Cc: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + drivers/block/drbd/drbd_nl.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +--- a/drivers/block/drbd/drbd_nl.c ++++ b/drivers/block/drbd/drbd_nl.c +@@ -791,9 +791,11 @@ int drbd_adm_set_role(struct sk_buff *sk + mutex_lock(&adm_ctx.resource->adm_mutex); + + if (info->genlhdr->cmd == DRBD_ADM_PRIMARY) +- retcode = drbd_set_role(adm_ctx.device, R_PRIMARY, parms.assume_uptodate); ++ retcode = (enum drbd_ret_code)drbd_set_role(adm_ctx.device, ++ R_PRIMARY, parms.assume_uptodate); + else +- retcode = drbd_set_role(adm_ctx.device, R_SECONDARY, 0); ++ retcode = (enum drbd_ret_code)drbd_set_role(adm_ctx.device, ++ R_SECONDARY, 0); + + mutex_unlock(&adm_ctx.resource->adm_mutex); + genl_lock(); +@@ -1971,7 +1973,7 @@ int drbd_adm_attach(struct sk_buff *skb, + drbd_flush_workqueue(&connection->sender_work); + + rv = _drbd_request_state(device, NS(disk, D_ATTACHING), CS_VERBOSE); +- retcode = rv; /* FIXME: Type mismatch. */ ++ retcode = (enum drbd_ret_code)rv; + drbd_resume_io(device); + if (rv < SS_SUCCESS) + goto fail; +@@ -2696,7 +2698,8 @@ int drbd_adm_connect(struct sk_buff *skb + } + rcu_read_unlock(); + +- retcode = conn_request_state(connection, NS(conn, C_UNCONNECTED), CS_VERBOSE); ++ retcode = (enum drbd_ret_code)conn_request_state(connection, ++ NS(conn, C_UNCONNECTED), CS_VERBOSE); + + conn_reconfig_done(connection); + mutex_unlock(&adm_ctx.resource->adm_mutex); +@@ -2809,7 +2812,7 @@ int drbd_adm_disconnect(struct sk_buff * + mutex_lock(&adm_ctx.resource->adm_mutex); + rv = conn_try_disconnect(connection, parms.force_disconnect); + if (rv < SS_SUCCESS) +- retcode = rv; /* FIXME: Type mismatch. */ ++ retcode = (enum drbd_ret_code)rv; + else + retcode = NO_ERROR; + mutex_unlock(&adm_ctx.resource->adm_mutex); diff --git a/queue-5.4/can-grcan-grcan_probe-fix-broken-system-id-check-for-errata-workaround-needs.patch b/queue-5.4/can-grcan-grcan_probe-fix-broken-system-id-check-for-errata-workaround-needs.patch new file mode 100644 index 00000000000..c9bf7134c88 --- /dev/null +++ b/queue-5.4/can-grcan-grcan_probe-fix-broken-system-id-check-for-errata-workaround-needs.patch @@ -0,0 +1,61 @@ +From 1e93ed26acf03fe6c97c6d573a10178596aadd43 Mon Sep 17 00:00:00 2001 +From: Andreas Larsson +Date: Fri, 29 Apr 2022 10:46:55 +0200 +Subject: can: grcan: grcan_probe(): fix broken system id check for errata workaround needs + +From: Andreas Larsson + +commit 1e93ed26acf03fe6c97c6d573a10178596aadd43 upstream. + +The systemid property was checked for in the wrong place of the device +tree and compared to the wrong value. + +Fixes: 6cec9b07fe6a ("can: grcan: Add device driver for GRCAN and GRHCAN cores") +Link: https://lore.kernel.org/all/20220429084656.29788-3-andreas@gaisler.com +Cc: stable@vger.kernel.org +Signed-off-by: Andreas Larsson +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/can/grcan.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +--- a/drivers/net/can/grcan.c ++++ b/drivers/net/can/grcan.c +@@ -241,7 +241,7 @@ struct grcan_device_config { + .rxsize = GRCAN_DEFAULT_BUFFER_SIZE, \ + } + +-#define GRCAN_TXBUG_SAFE_GRLIB_VERSION 0x4100 ++#define GRCAN_TXBUG_SAFE_GRLIB_VERSION 4100 + #define GRLIB_VERSION_MASK 0xffff + + /* GRCAN private data structure */ +@@ -1656,6 +1656,7 @@ exit_free_candev: + static int grcan_probe(struct platform_device *ofdev) + { + struct device_node *np = ofdev->dev.of_node; ++ struct device_node *sysid_parent; + struct resource *res; + u32 sysid, ambafreq; + int irq, err; +@@ -1665,10 +1666,15 @@ static int grcan_probe(struct platform_d + /* Compare GRLIB version number with the first that does not + * have the tx bug (see start_xmit) + */ +- err = of_property_read_u32(np, "systemid", &sysid); +- if (!err && ((sysid & GRLIB_VERSION_MASK) +- >= GRCAN_TXBUG_SAFE_GRLIB_VERSION)) +- txbug = false; ++ sysid_parent = of_find_node_by_path("/ambapp0"); ++ if (sysid_parent) { ++ of_node_get(sysid_parent); ++ err = of_property_read_u32(sysid_parent, "systemid", &sysid); ++ if (!err && ((sysid & GRLIB_VERSION_MASK) >= ++ GRCAN_TXBUG_SAFE_GRLIB_VERSION)) ++ txbug = false; ++ of_node_put(sysid_parent); ++ } + + err = of_property_read_u32(np, "freq", &ambafreq); + if (err) { diff --git a/queue-5.4/can-grcan-only-use-the-napi-poll-budget-for-rx.patch b/queue-5.4/can-grcan-only-use-the-napi-poll-budget-for-rx.patch new file mode 100644 index 00000000000..fb642445b00 --- /dev/null +++ b/queue-5.4/can-grcan-only-use-the-napi-poll-budget-for-rx.patch @@ -0,0 +1,87 @@ +From 2873d4d52f7c52d60b316ba6c47bd7122b5a9861 Mon Sep 17 00:00:00 2001 +From: Andreas Larsson +Date: Fri, 29 Apr 2022 10:46:56 +0200 +Subject: can: grcan: only use the NAPI poll budget for RX + +From: Andreas Larsson + +commit 2873d4d52f7c52d60b316ba6c47bd7122b5a9861 upstream. + +The previous split budget between TX and RX made it return not using +the entire budget but at the same time not having calling called +napi_complete. This sometimes led to the poll to not be called, and at +the same time having TX and RX interrupts disabled resulting in the +driver getting stuck. + +Fixes: 6cec9b07fe6a ("can: grcan: Add device driver for GRCAN and GRHCAN cores") +Link: https://lore.kernel.org/all/20220429084656.29788-4-andreas@gaisler.com +Cc: stable@vger.kernel.org +Signed-off-by: Andreas Larsson +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/can/grcan.c | 22 +++++++--------------- + 1 file changed, 7 insertions(+), 15 deletions(-) + +--- a/drivers/net/can/grcan.c ++++ b/drivers/net/can/grcan.c +@@ -1137,7 +1137,7 @@ static int grcan_close(struct net_device + return 0; + } + +-static int grcan_transmit_catch_up(struct net_device *dev, int budget) ++static void grcan_transmit_catch_up(struct net_device *dev) + { + struct grcan_priv *priv = netdev_priv(dev); + unsigned long flags; +@@ -1145,7 +1145,7 @@ static int grcan_transmit_catch_up(struc + + spin_lock_irqsave(&priv->lock, flags); + +- work_done = catch_up_echo_skb(dev, budget, true); ++ work_done = catch_up_echo_skb(dev, -1, true); + if (work_done) { + if (!priv->resetting && !priv->closing && + !(priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)) +@@ -1159,8 +1159,6 @@ static int grcan_transmit_catch_up(struc + } + + spin_unlock_irqrestore(&priv->lock, flags); +- +- return work_done; + } + + static int grcan_receive(struct net_device *dev, int budget) +@@ -1242,19 +1240,13 @@ static int grcan_poll(struct napi_struct + struct net_device *dev = priv->dev; + struct grcan_registers __iomem *regs = priv->regs; + unsigned long flags; +- int tx_work_done, rx_work_done; +- int rx_budget = budget / 2; +- int tx_budget = budget - rx_budget; ++ int work_done; + +- /* Half of the budget for receiveing messages */ +- rx_work_done = grcan_receive(dev, rx_budget); ++ work_done = grcan_receive(dev, budget); + +- /* Half of the budget for transmitting messages as that can trigger echo +- * frames being received +- */ +- tx_work_done = grcan_transmit_catch_up(dev, tx_budget); ++ grcan_transmit_catch_up(dev); + +- if (rx_work_done < rx_budget && tx_work_done < tx_budget) { ++ if (work_done < budget) { + napi_complete(napi); + + /* Guarantee no interference with a running reset that otherwise +@@ -1271,7 +1263,7 @@ static int grcan_poll(struct napi_struct + spin_unlock_irqrestore(&priv->lock, flags); + } + +- return rx_work_done + tx_work_done; ++ return work_done; + } + + /* Work tx bug by waiting while for the risky situation to clear. If that fails, diff --git a/queue-5.4/drm-amd-display-dc-gpio-gpio_service-pass-around-correct-dce_-version-environment-types.patch b/queue-5.4/drm-amd-display-dc-gpio-gpio_service-pass-around-correct-dce_-version-environment-types.patch new file mode 100644 index 00000000000..85b5df14f0d --- /dev/null +++ b/queue-5.4/drm-amd-display-dc-gpio-gpio_service-pass-around-correct-dce_-version-environment-types.patch @@ -0,0 +1,80 @@ +From 353f7f3a9dd5fd2833b6462bac89ec1654c9c3aa Mon Sep 17 00:00:00 2001 +From: Lee Jones +Date: Wed, 26 May 2021 09:47:06 +0100 +Subject: drm/amd/display/dc/gpio/gpio_service: Pass around correct dce_{version, environment} types +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Lee Jones + +commit 353f7f3a9dd5fd2833b6462bac89ec1654c9c3aa upstream. + +Fixes the following W=1 kernel build warning(s): + + drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c: In function ‘dal_gpio_service_create’: + drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:71:4: warning: implicit conversion from ‘enum dce_version’ to ‘enum dce_environment’ [-Wenum-conversion] + drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:77:4: warning: implicit conversion from ‘enum dce_version’ to ‘enum dce_environment’ [-Wenum-conversion] + +Cc: Harry Wentland +Cc: Leo Li +Cc: Alex Deucher +Cc: "Christian König" +Cc: David Airlie +Cc: Daniel Vetter +Cc: amd-gfx@lists.freedesktop.org +Cc: dri-devel@lists.freedesktop.org +Signed-off-by: Lee Jones +Signed-off-by: Alex Deucher +Cc: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c | 12 +++++------ + drivers/gpu/drm/amd/display/include/gpio_service_interface.h | 4 +-- + 2 files changed, 8 insertions(+), 8 deletions(-) + +--- a/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c ++++ b/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c +@@ -53,8 +53,8 @@ + */ + + struct gpio_service *dal_gpio_service_create( +- enum dce_version dce_version_major, +- enum dce_version dce_version_minor, ++ enum dce_version dce_version, ++ enum dce_environment dce_environment, + struct dc_context *ctx) + { + struct gpio_service *service; +@@ -67,14 +67,14 @@ struct gpio_service *dal_gpio_service_cr + return NULL; + } + +- if (!dal_hw_translate_init(&service->translate, dce_version_major, +- dce_version_minor)) { ++ if (!dal_hw_translate_init(&service->translate, dce_version, ++ dce_environment)) { + BREAK_TO_DEBUGGER(); + goto failure_1; + } + +- if (!dal_hw_factory_init(&service->factory, dce_version_major, +- dce_version_minor)) { ++ if (!dal_hw_factory_init(&service->factory, dce_version, ++ dce_environment)) { + BREAK_TO_DEBUGGER(); + goto failure_1; + } +--- a/drivers/gpu/drm/amd/display/include/gpio_service_interface.h ++++ b/drivers/gpu/drm/amd/display/include/gpio_service_interface.h +@@ -42,8 +42,8 @@ void dal_gpio_destroy( + struct gpio **ptr); + + struct gpio_service *dal_gpio_service_create( +- enum dce_version dce_version_major, +- enum dce_version dce_version_minor, ++ enum dce_version dce_version, ++ enum dce_environment dce_environment, + struct dc_context *ctx); + + struct gpio *dal_gpio_service_create_irq( diff --git a/queue-5.4/drm-i915-cast-remain-to-unsigned-long-in-eb_relocate_vma.patch b/queue-5.4/drm-i915-cast-remain-to-unsigned-long-in-eb_relocate_vma.patch new file mode 100644 index 00000000000..96c7556beea --- /dev/null +++ b/queue-5.4/drm-i915-cast-remain-to-unsigned-long-in-eb_relocate_vma.patch @@ -0,0 +1,58 @@ +From 7bf03e7504e433da274963c447648876902b86df Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Thu, 13 Feb 2020 22:47:07 -0700 +Subject: drm/i915: Cast remain to unsigned long in eb_relocate_vma +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Nathan Chancellor + +commit 7bf03e7504e433da274963c447648876902b86df upstream. + +A recent commit in clang added -Wtautological-compare to -Wall, which is +enabled for i915 after -Wtautological-compare is disabled for the rest +of the kernel so we see the following warning on x86_64: + + ../drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:1433:22: warning: + result of comparison of constant 576460752303423487 with expression of + type 'unsigned int' is always false + [-Wtautological-constant-out-of-range-compare] + if (unlikely(remain > N_RELOC(ULONG_MAX))) + ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ + ../include/linux/compiler.h:78:42: note: expanded from macro 'unlikely' + # define unlikely(x) __builtin_expect(!!(x), 0) + ^ + 1 warning generated. + +It is not wrong in the case where ULONG_MAX > UINT_MAX but it does not +account for the case where this file is built for 32-bit x86, where +ULONG_MAX == UINT_MAX and this check is still relevant. + +Cast remain to unsigned long, which keeps the generated code the same +(verified with clang-11 on x86_64 and GCC 9.2.0 on x86 and x86_64) and +the warning is silenced so we can catch more potential issues in the +future. + +Closes: https://github.com/ClangBuiltLinux/linux/issues/778 +Suggested-by: Michel Dänzer +Reviewed-by: Jani Nikula +Signed-off-by: Nathan Chancellor +Signed-off-by: Jani Nikula +Link: https://patchwork.freedesktop.org/patch/msgid/20200214054706.33870-1-natechancellor@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +@@ -1452,7 +1452,7 @@ static int eb_relocate_vma(struct i915_e + + urelocs = u64_to_user_ptr(entry->relocs_ptr); + remain = entry->relocation_count; +- if (unlikely(remain > N_RELOC(ULONG_MAX))) ++ if (unlikely((unsigned long)remain > N_RELOC(ULONG_MAX))) + return -EINVAL; + + /* diff --git a/queue-5.4/mips-use-address-of-operator-on-section-symbols.patch b/queue-5.4/mips-use-address-of-operator-on-section-symbols.patch new file mode 100644 index 00000000000..6df69c9e061 --- /dev/null +++ b/queue-5.4/mips-use-address-of-operator-on-section-symbols.patch @@ -0,0 +1,81 @@ +From d422c6c0644bccbb1ebeefffa51f35cec3019517 Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Tue, 5 Jan 2021 13:18:27 -0700 +Subject: MIPS: Use address-of operator on section symbols + +From: Nathan Chancellor + +commit d422c6c0644bccbb1ebeefffa51f35cec3019517 upstream. + +When building xway_defconfig with clang: + +arch/mips/lantiq/prom.c:82:23: error: array comparison always evaluates +to true [-Werror,-Wtautological-compare] + else if (__dtb_start != __dtb_end) + ^ +1 error generated. + +These are not true arrays, they are linker defined symbols, which are +just addresses. Using the address of operator silences the warning +and does not change the resulting assembly with either clang/ld.lld +or gcc/ld (tested with diff + objdump -Dr). Do the same thing across +the entire MIPS subsystem to ensure there are no more warnings around +this type of comparison. + +Link: https://github.com/ClangBuiltLinux/linux/issues/1232 +Signed-off-by: Nathan Chancellor +Acked-by: Florian Fainelli +Signed-off-by: Thomas Bogendoerfer +Cc: Sudip Mukherjee +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/bmips/setup.c | 2 +- + arch/mips/lantiq/prom.c | 2 +- + arch/mips/pic32/pic32mzda/init.c | 2 +- + arch/mips/ralink/of.c | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/mips/bmips/setup.c ++++ b/arch/mips/bmips/setup.c +@@ -167,7 +167,7 @@ void __init plat_mem_setup(void) + dtb = phys_to_virt(fw_arg2); + else if (fw_passed_dtb) /* UHI interface or appended dtb */ + dtb = (void *)fw_passed_dtb; +- else if (__dtb_start != __dtb_end) ++ else if (&__dtb_start != &__dtb_end) + dtb = (void *)__dtb_start; + else + panic("no dtb found"); +--- a/arch/mips/lantiq/prom.c ++++ b/arch/mips/lantiq/prom.c +@@ -79,7 +79,7 @@ void __init plat_mem_setup(void) + + if (fw_passed_dtb) /* UHI interface */ + dtb = (void *)fw_passed_dtb; +- else if (__dtb_start != __dtb_end) ++ else if (&__dtb_start != &__dtb_end) + dtb = (void *)__dtb_start; + else + panic("no dtb found"); +--- a/arch/mips/pic32/pic32mzda/init.c ++++ b/arch/mips/pic32/pic32mzda/init.c +@@ -28,7 +28,7 @@ static ulong get_fdtaddr(void) + if (fw_passed_dtb && !fw_arg2 && !fw_arg3) + return (ulong)fw_passed_dtb; + +- if (__dtb_start < __dtb_end) ++ if (&__dtb_start < &__dtb_end) + ftaddr = (ulong)__dtb_start; + + return ftaddr; +--- a/arch/mips/ralink/of.c ++++ b/arch/mips/ralink/of.c +@@ -77,7 +77,7 @@ void __init plat_mem_setup(void) + */ + if (fw_passed_dtb) + dtb = (void *)fw_passed_dtb; +- else if (__dtb_start != __dtb_end) ++ else if (&__dtb_start != &__dtb_end) + dtb = (void *)__dtb_start; + + __dt_setup_arch(dtb); diff --git a/queue-5.4/nfp-bpf-silence-bitwise-vs.-logical-or-warning.patch b/queue-5.4/nfp-bpf-silence-bitwise-vs.-logical-or-warning.patch new file mode 100644 index 00000000000..0131ed83caf --- /dev/null +++ b/queue-5.4/nfp-bpf-silence-bitwise-vs.-logical-or-warning.patch @@ -0,0 +1,61 @@ +From 8a64ef042eab8a6cec04a6c79d44d1af79b628ca Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Mon, 18 Oct 2021 12:31:01 -0700 +Subject: nfp: bpf: silence bitwise vs. logical OR warning + +From: Nathan Chancellor + +commit 8a64ef042eab8a6cec04a6c79d44d1af79b628ca upstream. + +A new warning in clang points out two places in this driver where +boolean expressions are being used with a bitwise OR instead of a +logical one: + +drivers/net/ethernet/netronome/nfp/nfp_asm.c:199:20: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical] + reg->src_lmextn = swreg_lmextn(lreg) | swreg_lmextn(rreg); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + || +drivers/net/ethernet/netronome/nfp/nfp_asm.c:199:20: note: cast one or both operands to int to silence this warning +drivers/net/ethernet/netronome/nfp/nfp_asm.c:280:20: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical] + reg->src_lmextn = swreg_lmextn(lreg) | swreg_lmextn(rreg); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + || +drivers/net/ethernet/netronome/nfp/nfp_asm.c:280:20: note: cast one or both operands to int to silence this warning +2 errors generated. + +The motivation for the warning is that logical operations short circuit +while bitwise operations do not. In this case, it does not seem like +short circuiting is harmful so implement the suggested fix of changing +to a logical operation to fix the warning. + +Link: https://github.com/ClangBuiltLinux/linux/issues/1479 +Reported-by: Nick Desaulniers +Signed-off-by: Nathan Chancellor +Reviewed-by: Nick Desaulniers +Link: https://lore.kernel.org/r/20211018193101.2340261-1-nathan@kernel.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/netronome/nfp/nfp_asm.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/netronome/nfp/nfp_asm.c ++++ b/drivers/net/ethernet/netronome/nfp/nfp_asm.c +@@ -196,7 +196,7 @@ int swreg_to_unrestricted(swreg dst, swr + } + + reg->dst_lmextn = swreg_lmextn(dst); +- reg->src_lmextn = swreg_lmextn(lreg) | swreg_lmextn(rreg); ++ reg->src_lmextn = swreg_lmextn(lreg) || swreg_lmextn(rreg); + + return 0; + } +@@ -277,7 +277,7 @@ int swreg_to_restricted(swreg dst, swreg + } + + reg->dst_lmextn = swreg_lmextn(dst); +- reg->src_lmextn = swreg_lmextn(lreg) | swreg_lmextn(rreg); ++ reg->src_lmextn = swreg_lmextn(lreg) || swreg_lmextn(rreg); + + return 0; + } diff --git a/queue-5.4/series b/queue-5.4/series new file mode 100644 index 00000000000..ea4e2bd545b --- /dev/null +++ b/queue-5.4/series @@ -0,0 +1,7 @@ +mips-use-address-of-operator-on-section-symbols.patch +block-drbd-drbd_nl-make-conversion-to-enum-drbd_ret_code-explicit.patch +drm-amd-display-dc-gpio-gpio_service-pass-around-correct-dce_-version-environment-types.patch +drm-i915-cast-remain-to-unsigned-long-in-eb_relocate_vma.patch +nfp-bpf-silence-bitwise-vs.-logical-or-warning.patch +can-grcan-grcan_probe-fix-broken-system-id-check-for-errata-workaround-needs.patch +can-grcan-only-use-the-napi-poll-budget-for-rx.patch