From patchwork Sat May 22 19:10:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 53281 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7170AB7D1E for ; Sun, 23 May 2010 05:12:38 +1000 (EST) Received: from localhost ([127.0.0.1]:51173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFu7f-0003Bu-4G for incoming@patchwork.ozlabs.org; Sat, 22 May 2010 15:12:35 -0400 Received: from [140.186.70.92] (port=51304 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFu6O-00039z-Ne for qemu-devel@nongnu.org; Sat, 22 May 2010 15:11:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFu6M-0001iv-I2 for qemu-devel@nongnu.org; Sat, 22 May 2010 15:11:16 -0400 Received: from mail-pz0-f181.google.com ([209.85.222.181]:51672) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFu6M-0001ih-8l for qemu-devel@nongnu.org; Sat, 22 May 2010 15:11:14 -0400 Received: by pzk11 with SMTP id 11so1217915pzk.28 for ; Sat, 22 May 2010 12:11:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=BKnkGq2f+GXwRv1vsIImxCbWegE/7orSIJoNThuRs8w=; b=AUhq7WE3o77M/HvJhvUReQ0rRlDXT481uI9wBMyvdsRAm5gLVOuJwMhT2nIDgfCcyM KdyNJU0p3XjBxBqIw+jKPKmrCn2O6r16ysjpUudpa5u1tNoLpuBlOw4T3YJtrAPNhsF4 3Vanojw8CPAUKstIVpcgsha26y5Cocd1lF8zw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=RUeBGXbFTpCXx/WatdzLhxY/K6q30Ta+uh4waw9+Dz4BE7cJAr6EHQXBCkoj2zoCqA jsuZCX/LwqiuZTRVoCjhnuiqovBoCgnz8NgV/FUbXRjDZY+gcRHJAttpMUvXHRtOSBVL 4eOX9b9yJI8CXGtQ3MDO5fcTqvdWJgc48eB2I= Received: by 10.141.139.2 with SMTP id r2mr2515343rvn.83.1274555473394; Sat, 22 May 2010 12:11:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.141.44.12 with HTTP; Sat, 22 May 2010 12:10:53 -0700 (PDT) From: Blue Swirl Date: Sat, 22 May 2010 19:10:53 +0000 Message-ID: To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 2/2] virtio-9p: fix OpenBSD linker warnings X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org virtio-9p.o(.text+0x13c0): In function `v9fs_string_alloc_printf': /src/qemu/hw/virtio-9p.c:270: warning: vsprintf() is often misused, please use vsnprintf() ../libhw32/vl.o(.text+0x757c): In function `main': /src/qemu/vl.c:3124: warning: sprintf() is often misused, please use snprintf() Signed-off-by: Blue Swirl --- hw/virtio-9p.c | 2 +- vl.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) fprintf(stderr, "parse error [fsdev]: %s\n", optarg); diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c index 68b0696..ee81a7a 100644 --- a/hw/virtio-9p.c +++ b/hw/virtio-9p.c @@ -267,7 +267,7 @@ static int v9fs_string_alloc_printf(char **strp, const char *fmt, va_list ap) alloc_print: *strp = qemu_malloc((len + 1) * sizeof(**strp)); - return vsprintf(*strp, fmt, ap); + return vsnprintf(*strp, len + 1, fmt, ap); } static void v9fs_string_sprintf(V9fsString *str, const char *fmt, ...) diff --git a/vl.c b/vl.c index d5c1e34..d66b94f 100644 --- a/vl.c +++ b/vl.c @@ -3121,10 +3121,10 @@ int main(int argc, char **argv, char **envp) exit(1); } - sprintf(arg_fsdev, "%s,id=%s,path=%s", - qemu_opt_get(opts, "fstype"), - qemu_opt_get(opts, "mount_tag"), - qemu_opt_get(opts, "path")); + snprintf(arg_fsdev, len + 1, "%s,id=%s,path=%s", + qemu_opt_get(opts, "fstype"), + qemu_opt_get(opts, "mount_tag"), + qemu_opt_get(opts, "path")); len = strlen("virtio-9p-pci,fsdev=,mount_tag="); len += 2*strlen(qemu_opt_get(opts, "mount_tag")); @@ -3136,9 +3136,9 @@ int main(int argc, char **argv, char **envp) exit(1); } - sprintf(arg_9p, "virtio-9p-pci,fsdev=%s,mount_tag=%s", - qemu_opt_get(opts, "mount_tag"), - qemu_opt_get(opts, "mount_tag")); + snprintf(arg_9p, len + 1, "virtio-9p-pci,fsdev=%s,mount_tag=%s", + qemu_opt_get(opts, "mount_tag"), + qemu_opt_get(opts, "mount_tag")); if (!qemu_opts_parse(&qemu_fsdev_opts, arg_fsdev, 1)) {