qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Ari Sundholm <ari@tuxera.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, famz@redhat.com, qemu-block@nongnu.org,
	mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 00/10] New block driver: blklogwrites
Date: Thu, 7 Jun 2018 13:59:02 -0500	[thread overview]
Message-ID: <a5e7f77f-d67c-67cf-6093-a73864734750@redhat.com> (raw)
In-Reply-To: <81cb1d4e-c50a-fb3b-5fef-eec378296868@tuxera.com>

On 06/07/2018 01:28 PM, Ari Sundholm wrote:
> On 06/07/2018 07:13 PM, no-reply@patchew.org wrote:
>> Hi,
>>
>> This series failed build test on s390x host. Please find the details 
>> below.
>>

>> /var/tmp/patchew-tester-tmp-8bz4jnox/src/block/blklogwrites.c: In 
>> function ‘blk_log_writes_refresh_filename’:
>> /var/tmp/patchew-tester-tmp-8bz4jnox/src/block/blklogwrites.c:136:32: 
>> error: ‘%s’ directive output may be truncated writing up to 4095 bytes 
>> into a region of size 4083 [-Werror=format-truncation=]
>>                    "blklogwrites:%s:%s",
>>                                  ^~
>> In file included from /usr/include/stdio.h:939:0,
>>                   from 
>> /var/tmp/patchew-tester-tmp-8bz4jnox/src/include/qemu/osdep.h:68,
>>                   from 
>> /var/tmp/patchew-tester-tmp-8bz4jnox/src/block/blklogwrites.c:12:
>> /usr/include/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ 
>> output between 15 and 8205 bytes into a destination of size 4096
>>     return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
>>            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>          __bos (__s), __fmt, __va_arg_pack ());
>>          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> cc1: all warnings being treated as errors
>> make: *** [/var/tmp/patchew-tester-tmp-8bz4jnox/src/rules.mak:69: 
>> block/blklogwrites.o] Error 1
>> make: *** Waiting for unfinished jobs....
>>    CC      block/qapi.o
>> === OUTPUT END ===
>>
>> Test command exited with code: 2
>>
> 
> Given that blkverify.c has a similar snprintf() call, with the exception 
> that it checks the return value in case the string was truncated, am I 
> safe in assuming that adding a check for the return value of snprintf() 
> fixes this one? I don't really see anything else I could do about the 
> error.

Well, ideally we'd g_strdup_printf() the string (and g_free() it later) 
rather than use a fixed-size array, if we HAVE to produce a 
legacy-format name in the first place.  But if we stick with a 
fixed-width buffer, perhaps checking for snprintf() truncation, and 
returning NULL in that case, is enough to force a fallback to a 
pseudo-JSON string so that the end user doesn't lose information and the 
compiler doesn't complain about failure to check for truncation.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

  reply	other threads:[~2018-06-07 18:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07 15:38 [Qemu-devel] [PATCH v3 00/10] New block driver: blklogwrites Ari Sundholm
2018-06-07 15:38 ` [Qemu-devel] [PATCH v3 01/10] block: Move two block permission constants to the relevant enum Ari Sundholm
2018-06-07 15:38 ` [Qemu-devel] [PATCH v3 02/10] block: Add blklogwrites Ari Sundholm
2018-06-07 18:56   ` Eric Blake
2018-06-07 15:38 ` [Qemu-devel] [PATCH v3 03/10] block: Add a mechanism for passing a block driver a block configuration Ari Sundholm
2018-06-07 15:38 ` [Qemu-devel] [PATCH v3 04/10] hw/scsi/scsi-disk: Always apply block configuration to block driver Ari Sundholm
2018-06-07 15:38 ` [Qemu-devel] [PATCH v3 05/10] hw/ide/qdev: " Ari Sundholm
2018-06-07 15:38 ` [Qemu-devel] [PATCH v3 06/10] hw/block/virtio-blk: " Ari Sundholm
2018-06-07 15:38 ` [Qemu-devel] [PATCH v3 07/10] hw/block/nvme: " Ari Sundholm
2018-06-07 15:38 ` [Qemu-devel] [PATCH v3 08/10] hw/block/fdc: " Ari Sundholm
2018-06-07 15:38 ` [Qemu-devel] [PATCH v3 09/10] block/blklogwrites: Use block limits from the backend block configuration Ari Sundholm
2018-06-07 15:38 ` [Qemu-devel] [PATCH v3 10/10] block/blklogwrites: Use the block device logical sector size when logging writes Ari Sundholm
2018-06-07 16:13 ` [Qemu-devel] [PATCH v3 00/10] New block driver: blklogwrites no-reply
2018-06-07 18:28   ` Ari Sundholm
2018-06-07 18:59     ` Eric Blake [this message]
2018-06-07 19:15       ` Ari Sundholm

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=a5e7f77f-d67c-67cf-6093-a73864734750@redhat.com \
    --to=eblake@redhat.com \
    --cc=ari@tuxera.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).