[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 10/10] block/vvfat: fix setbuf stream paramet
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH v6 10/10] block/vvfat: fix setbuf stream parameter may be NULL |
Date: |
Thu, 14 Aug 2014 12:36:22 +0200 |
On Thu, Aug 14, 2014 at 03:29:21PM +0800, zhanghailiang wrote:
> From: Li Liu <address@hidden>
>
> fopen() may return NULL which will cause setbuf() segmentfault
>
> Signed-off-by: zhanghailiang <address@hidden>
> Signed-off-by: Li Liu <address@hidden>
> ---
> block/vvfat.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/block/vvfat.c b/block/vvfat.c
> index 70176b1..6889ea9 100644
> --- a/block/vvfat.c
> +++ b/block/vvfat.c
> @@ -1084,7 +1084,10 @@ static int vvfat_open(BlockDriverState *bs, QDict
> *options, int flags,
>
> DLOG(if (stderr == NULL) {
> stderr = fopen("vvfat.log", "a");
> - setbuf(stderr, NULL);
> +
> + if (stderr) {
> + setbuf(stderr, NULL);
> + }
> })
>
> opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
I would say assert on failure here.
If one is trying to debug, seeing no output will just confuse
matters more.
> --
> 1.7.12.4
>
- Re: [Qemu-devel] [Qemu-trivial] [PATCH v6 09/10] tcg: check return value of fopen(), (continued)
- [Qemu-devel] [PATCH v6 08/10] tests/bios-tables-test: check the value returned by fopen(), zhanghailiang, 2014/08/14
- [Qemu-devel] [PATCH v6 10/10] block/vvfat: fix setbuf stream parameter may be NULL, zhanghailiang, 2014/08/14
- Re: [Qemu-devel] [PATCH v6 10/10] block/vvfat: fix setbuf stream parameter may be NULL,
Michael S. Tsirkin <=
- [Qemu-devel] [PATCH v6 01/10] l2cap: fix access freed memory, zhanghailiang, 2014/08/14
- Re: [Qemu-devel] [PATCH v6 00/10] fix three bugs about use-after-free and several api abuse, Michael S. Tsirkin, 2014/08/14
- Re: [Qemu-devel] [PATCH v6 00/10] fix three bugs about use-after-free and several api abuse, Michael S. Tsirkin, 2014/08/14