Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 294001a8 authored by Stefan Haberland's avatar Stefan Haberland Committed by Martin Schwidefsky
Browse files

[S390] dasd: fix possible NULL pointer errors



Fix possible NULL pointer in DASD messages and correct discipline
checking.

Signed-off-by: default avatarStefan Haberland <stefan.haberland@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent b04da8bf
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1004,8 +1004,8 @@ static void dasd_handle_killed_request(struct ccw_device *cdev,
	if (device == NULL ||
	    device != dasd_device_from_cdev_locked(cdev) ||
	    strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) {
		DBF_DEV_EVENT(DBF_DEBUG, device, "invalid device in request: "
			      "bus_id %s", dev_name(&cdev->dev));
		DBF_EVENT_DEVID(DBF_DEBUG, cdev, "%s",
				"invalid device in request");
		return;
	}

@@ -1078,8 +1078,8 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
	device = (struct dasd_device *) cqr->startdev;
	if (!device ||
	    strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) {
		DBF_DEV_EVENT(DBF_DEBUG, device, "invalid device in request: "
			      "bus_id %s", dev_name(&cdev->dev));
		DBF_EVENT_DEVID(DBF_DEBUG, cdev, "%s",
				"invalid device in request");
		return;
	}

+1 −1
Original line number Diff line number Diff line
@@ -3033,7 +3033,7 @@ static void dasd_eckd_dump_sense_ccw(struct dasd_device *device,
	len += sprintf(page + len, KERN_ERR PRINTK_HEADER
		       " in req: %p CS: 0x%02X DS: 0x%02X CC: 0x%02X RC: %d\n",
		       req, scsw_cstat(&irb->scsw), scsw_dstat(&irb->scsw),
		       scsw_cc(&irb->scsw), req->intrc);
		       scsw_cc(&irb->scsw), req ? req->intrc : 0);
	len += sprintf(page + len, KERN_ERR PRINTK_HEADER
		       " device %s: Failing CCW: %p\n",
		       dev_name(&device->cdev->dev),
+2 −5
Original line number Diff line number Diff line
@@ -260,7 +260,7 @@ static int dasd_ioctl_information(struct dasd_block *block,
	struct ccw_dev_id dev_id;

	base = block->base;
	if (!base->discipline->fill_info)
	if (!base->discipline || !base->discipline->fill_info)
		return -EINVAL;

	dasd_info = kzalloc(sizeof(struct dasd_information2_t), GFP_KERNEL);
@@ -303,10 +303,7 @@ static int dasd_ioctl_information(struct dasd_block *block,
	dasd_info->features |=
		((base->features & DASD_FEATURE_READONLY) != 0);

	if (base->discipline)
	memcpy(dasd_info->type, base->discipline->name, 4);
	else
		memcpy(dasd_info->type, "none", 4);

	if (block->request_queue->request_fn) {
		struct list_head *l;
+2 −5
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ dasd_devices_show(struct seq_file *m, void *v)
	/* Print device number. */
	seq_printf(m, "%s", dev_name(&device->cdev->dev));
	/* Print discipline string. */
	if (device != NULL && device->discipline != NULL)
	if (device->discipline != NULL)
		seq_printf(m, "(%s)", device->discipline->name);
	else
		seq_printf(m, "(none)");
@@ -92,10 +92,7 @@ dasd_devices_show(struct seq_file *m, void *v)
	substr = (device->features & DASD_FEATURE_READONLY) ? "(ro)" : " ";
	seq_printf(m, "%4s: ", substr);
	/* Print device status information. */
	switch ((device != NULL) ? device->state : -1) {
	case -1:
		seq_printf(m, "unknown");
		break;
	switch (device->state) {
	case DASD_STATE_NEW:
		seq_printf(m, "new");
		break;