From: Dan Carpenter <dan.carpenter@oracle.com>
To: richard@nod.at
Cc: linux-um@lists.infradead.org
Subject: [bug report] um: Convert ubd driver to blk-mq
Date: Fri, 22 Feb 2019 14:11:00 +0300 [thread overview]
Message-ID: <20190222111100.GA19880@kadam> (raw)
Hello Richard Weinberger,
The patch 4e6da0fe8058: "um: Convert ubd driver to blk-mq" from Nov
26, 2017, leads to the following static checker warning:
arch/um/drivers/ubd_kern.c:972 ubd_add()
error: 'ubd_dev->queue' dereferencing possible ERR_PTR()
arch/um/drivers/ubd_kern.c
911 static int ubd_add(int n, char **error_out)
912 {
913 struct ubd *ubd_dev = &ubd_devs[n];
914 int err = 0;
915
916 if(ubd_dev->file == NULL)
917 goto out;
918
919 err = ubd_file_size(ubd_dev, &ubd_dev->size);
920 if(err < 0){
921 *error_out = "Couldn't determine size of device's file";
922 goto out;
923 }
924
925 ubd_dev->size = ROUND_BLOCK(ubd_dev->size);
926
927 ubd_dev->tag_set.ops = &ubd_mq_ops;
928 ubd_dev->tag_set.queue_depth = 64;
929 ubd_dev->tag_set.numa_node = NUMA_NO_NODE;
930 ubd_dev->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
931 ubd_dev->tag_set.driver_data = ubd_dev;
932 ubd_dev->tag_set.nr_hw_queues = 1;
933
934 err = blk_mq_alloc_tag_set(&ubd_dev->tag_set);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
We do want to clean up this allocation.
935 if (err)
936 goto out;
937
938 ubd_dev->queue = blk_mq_init_queue(&ubd_dev->tag_set);
939 if (IS_ERR(ubd_dev->queue)) {
940 err = PTR_ERR(ubd_dev->queue);
941 goto out_cleanup;
^^^^^^^^^^^^^^^^
But this goto will Oops.
942 }
943
944 ubd_dev->queue->queuedata = ubd_dev;
945 blk_queue_write_cache(ubd_dev->queue, true, false);
946
947 blk_queue_max_segments(ubd_dev->queue, MAX_SG);
948 err = ubd_disk_register(UBD_MAJOR, ubd_dev->size, n, &ubd_gendisk[n]);
949 if(err){
950 *error_out = "Failed to register device";
951 goto out_cleanup_tags;
952 }
953
954 if (fake_major != UBD_MAJOR)
955 ubd_disk_register(fake_major, ubd_dev->size, n,
956 &fake_gendisk[n]);
957
958 /*
959 * Perhaps this should also be under the "if (fake_major)" above
960 * using the fake_disk->disk_name
961 */
962 if (fake_ide)
963 make_ide_entries(ubd_gendisk[n]->disk_name);
964
965 err = 0;
966 out:
967 return err;
968
969 out_cleanup_tags:
970 blk_mq_free_tag_set(&ubd_dev->tag_set);
971 out_cleanup:
--> 972 blk_cleanup_queue(ubd_dev->queue);
^^^^^^^^^^^^^^
973 goto out;
974 }
regards,
dan carpenter
_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
next reply other threads:[~2019-02-22 11:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-22 11:11 Dan Carpenter [this message]
2019-02-22 12:31 ` [bug report] um: Convert ubd driver to blk-mq Anton Ivanov
-- strict thread matches above, loose matches on Subject: below --
2018-10-17 9:26 Dan Carpenter
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=20190222111100.GA19880@kadam \
--to=dan.carpenter@oracle.com \
--cc=linux-um@lists.infradead.org \
--cc=richard@nod.at \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox