* [Qemu-devel] [PATCH] sd: Avoid access to NULL BlockDriverState
@ 2013-10-16 13:24 Andreas Färber
2013-10-17 8:15 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Färber @ 2013-10-16 13:24 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, peter.maydell, aliguori, stefanha, Andreas Färber
Commit 4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf (blockdev: Remove IF_*
check for read-only blockdev_init) added a usage of bdrv_is_read_only()
to sd_init(), which is called for versatilepb, versatileab and
xilinx-zynq-a9 machines among others with NULL argument by default,
causing the new qom-test to fail.
Add a check to prevent this.
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
hw/sd/sd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 7380f06..4502ad1 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -494,7 +494,7 @@ SDState *sd_init(BlockDriverState *bs, bool is_spi)
{
SDState *sd;
- if (bdrv_is_read_only(bs)) {
+ if (bs && bdrv_is_read_only(bs)) {
fprintf(stderr, "sd_init: Cannot use read-only drive\n");
return NULL;
}
--
1.8.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] sd: Avoid access to NULL BlockDriverState
2013-10-16 13:24 [Qemu-devel] [PATCH] sd: Avoid access to NULL BlockDriverState Andreas Färber
@ 2013-10-17 8:15 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2013-10-17 8:15 UTC (permalink / raw)
To: Andreas Färber; +Cc: kwolf, peter.maydell, stefanha, qemu-devel, aliguori
On Wed, Oct 16, 2013 at 03:24:01PM +0200, Andreas Färber wrote:
> Commit 4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf (blockdev: Remove IF_*
> check for read-only blockdev_init) added a usage of bdrv_is_read_only()
> to sd_init(), which is called for versatilepb, versatileab and
> xilinx-zynq-a9 machines among others with NULL argument by default,
> causing the new qom-test to fail.
>
> Add a check to prevent this.
>
> Suggested-by: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
> hw/sd/sd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-17 8:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-16 13:24 [Qemu-devel] [PATCH] sd: Avoid access to NULL BlockDriverState Andreas Färber
2013-10-17 8:15 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).