All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Jan Höppner" <hoeppner@linux.ibm.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Peter Oberparleiter" <oberpar@linux.ibm.com>,
	"Stefan Haberland" <sth@linux.ibm.com>,
	"Jens Axboe" <axboe@kernel.dk>, "Sasha Levin" <sashal@kernel.org>,
	linux-s390@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 50/57] s390/dasd/cio: Interpret ccw_device_get_mdc return value correctly
Date: Fri, 27 Dec 2019 13:02:15 -0500	[thread overview]
Message-ID: <20191227180222.7076-50-sashal@kernel.org> (raw)
In-Reply-To: <20191227180222.7076-1-sashal@kernel.org>

From: Jan Höppner <hoeppner@linux.ibm.com>

[ Upstream commit dd4b3c83b9efac10d48a94c61372119fc555a077 ]

The max data count (mdc) is an unsigned 16-bit integer value as per AR
documentation and is received via ccw_device_get_mdc() for a specific
path mask from the CIO layer. The function itself also always returns a
positive mdc value or 0 in case mdc isn't supported or couldn't be
determined.

Though, the comment for this function describes a negative return value
to indicate failures.

As a result, the DASD device driver interprets the return value of
ccw_device_get_mdc() incorrectly. The error case is essentially a dead
code path.

To fix this behaviour, check explicitly for a return value of 0 and
change the comment for ccw_device_get_mdc() accordingly.

This fix merely enables the error code path in the DASD functions
get_fcx_max_data() and verify_fcx_max_data(). The actual functionality
stays the same and is still correct.

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Acked-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/s390/block/dasd_eckd.c | 9 +++++----
 drivers/s390/cio/device_ops.c  | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 0d5e2d92e05b..81359312a987 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -1133,7 +1133,8 @@ static u32 get_fcx_max_data(struct dasd_device *device)
 {
 	struct dasd_eckd_private *private = device->private;
 	int fcx_in_css, fcx_in_gneq, fcx_in_features;
-	int tpm, mdc;
+	unsigned int mdc;
+	int tpm;
 
 	if (dasd_nofcx)
 		return 0;
@@ -1147,7 +1148,7 @@ static u32 get_fcx_max_data(struct dasd_device *device)
 		return 0;
 
 	mdc = ccw_device_get_mdc(device->cdev, 0);
-	if (mdc < 0) {
+	if (mdc == 0) {
 		dev_warn(&device->cdev->dev, "Detecting the maximum supported data size for zHPF requests failed\n");
 		return 0;
 	} else {
@@ -1158,12 +1159,12 @@ static u32 get_fcx_max_data(struct dasd_device *device)
 static int verify_fcx_max_data(struct dasd_device *device, __u8 lpm)
 {
 	struct dasd_eckd_private *private = device->private;
-	int mdc;
+	unsigned int mdc;
 	u32 fcx_max_data;
 
 	if (private->fcx_max_data) {
 		mdc = ccw_device_get_mdc(device->cdev, lpm);
-		if ((mdc < 0)) {
+		if (mdc == 0) {
 			dev_warn(&device->cdev->dev,
 				 "Detecting the maximum data size for zHPF "
 				 "requests failed (rc=%d) for a new path %x\n",
diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c
index b22922ec32d1..474afec9ab87 100644
--- a/drivers/s390/cio/device_ops.c
+++ b/drivers/s390/cio/device_ops.c
@@ -595,7 +595,7 @@ EXPORT_SYMBOL(ccw_device_tm_start_timeout);
  * @mask: mask of paths to use
  *
  * Return the number of 64K-bytes blocks all paths at least support
- * for a transport command. Return values <= 0 indicate failures.
+ * for a transport command. Return value 0 indicates failure.
  */
 int ccw_device_get_mdc(struct ccw_device *cdev, u8 mask)
 {
-- 
2.20.1


  parent reply	other threads:[~2019-12-27 18:03 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-27 18:01 [PATCH AUTOSEL 4.14 01/57] mwifiex: fix possible heap overflow in mwifiex_process_country_ie() Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 02/57] locking/spinlock/debug: Fix various data races Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 03/57] netfilter: ctnetlink: netns exit must wait for callbacks Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 04/57] mwifiex: Fix heap overflow in mmwifiex_process_tdls_action_frame() Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 05/57] libtraceevent: Fix lib installation with O= Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 06/57] x86/efi: Update e820 with reserved EFI boot services data to fix kexec breakage Sasha Levin
2019-12-27 18:01   ` Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 07/57] netfilter: nf_queue: enqueue skbs with NULL dst Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 08/57] efi/gop: Return EFI_NOT_FOUND if there are no usable GOPs Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 09/57] efi/gop: Return EFI_SUCCESS if a usable GOP was found Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 10/57] efi/gop: Fix memory leak in __gop_query32/64() Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 11/57] ARM: vexpress: Set-up shared OPP table instead of individual for each CPU Sasha Levin
2019-12-27 18:01   ` Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 12/57] netfilter: uapi: Avoid undefined left-shift in xt_sctp.h Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 13/57] netfilter: nf_tables: validate NFT_SET_ELEM_INTERVAL_END Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 14/57] netfilter: bridge: make sure to pull arp header in br_nf_forward_arp() Sasha Levin
2019-12-27 18:01   ` [Bridge] " Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 15/57] ARM: dts: Cygnus: Fix MDIO node address/size cells Sasha Levin
2019-12-27 18:01   ` Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 16/57] spi: spi-cavium-thunderx: Add missing pci_release_regions() Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 17/57] af_packet: set defaule value for tmo Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 18/57] fjes: fix missed check in fjes_acpi_add Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 19/57] ASoC: topology: Check return value for soc_tplg_pcm_create() Sasha Levin
2019-12-27 18:01   ` [alsa-devel] " Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 20/57] ARM: dts: bcm283x: Fix critical trip point Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 21/57] net: ena: fix napi handler misbehavior when the napi budget is zero Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 22/57] bpf, mips: Limit to 33 tail calls Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 23/57] ARM: dts: am437x-gp/epos-evm: fix panel compatible Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 24/57] samples: bpf: Replace symbol compare of trace_event Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 25/57] samples: bpf: fix syscall_tp due to unused syscall Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 26/57] tty: serial: msm_serial: Fix lockup for sysrq and oops Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 27/57] net: usb: lan78xx: Fix suspend/resume PHY register access error Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 28/57] qede: Fix multicast mac configuration Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 29/57] powerpc: Ensure that swiotlb buffer is allocated from low memory Sasha Levin
2019-12-27 18:01   ` Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 30/57] 6pack,mkiss: fix possible deadlock Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 31/57] bnx2x: Do not handle requests from VFs after parity Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 32/57] bnx2x: Fix logic to get total no. of PFs per engine Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 33/57] bonding: fix active-backup transition after link failure Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 34/57] gtp: do not allow adding duplicate tid and ms_addr pdp context Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 35/57] gtp: fix wrong condition in gtp_genl_dump_pdp() Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 36/57] gtp: avoid zero size hashtable Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 37/57] net: usb: lan78xx: Fix error message format specifier Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 38/57] rfkill: Fix incorrect check to avoid NULL pointer dereference Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 39/57] ASoC: wm8962: fix lambda value Sasha Levin
2019-12-27 18:02   ` [alsa-devel] " Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 40/57] regulator: rn5t618: fix module aliases Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 41/57] kconfig: don't crash on NULL expressions in expr_eq() Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 42/57] perf/x86/intel/bts: Fix the use of page_private() Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 43/57] perf/x86/intel: Fix PT PMI handling Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 44/57] fs: avoid softlockups in s_inodes iterators Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 45/57] net: qlogic: Fix error paths in ql_alloc_large_buffers() Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 46/57] net: nfc: nci: fix a possible sleep-in-atomic-context bug in nci_uart_tty_receive() Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 47/57] net: stmmac: Do not accept invalid MTU values Sasha Levin
2019-12-27 18:02   ` Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 48/57] net: stmmac: RX buffer size must be 16 byte aligned Sasha Levin
2019-12-27 18:02   ` Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 49/57] net, sysctl: Fix compiler warning when only cBPF is present Sasha Levin
2019-12-27 18:02 ` Sasha Levin [this message]
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 51/57] s390/dasd: fix memleak in path handling error case Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 52/57] block: fix memleak when __blk_rq_map_user_iov() is failed Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 53/57] parisc: Fix compiler warnings in debug_core.c Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 54/57] net: hisilicon: Fix a BUG trigered by wrong bytes_compl Sasha Levin

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=20191227180222.7076-50-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=cohuck@redhat.com \
    --cc=hoeppner@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=oberpar@linux.ibm.com \
    --cc=stable@vger.kernel.org \
    --cc=sth@linux.ibm.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.