From: Eric Blake <eblake@redhat.com>
To: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/9] Add API to manipulate dump_bitmap
Date: Tue, 07 May 2013 10:14:11 -0600 [thread overview]
Message-ID: <51892853.8040001@redhat.com> (raw)
In-Reply-To: <1367911007-13990-2-git-send-email-qiaonuohan@cn.fujitsu.com>
[-- Attachment #1: Type: text/plain, Size: 2058 bytes --]
On 05/07/2013 01:16 AM, Qiao Nuohan wrote:
> Struct dump_bitmap is associated with a tmp file, and the tmp file can be used
> to save data of bitmap in kdump-compressed format temporarily.
> The following patch will use these functions to get the data of bitmap and cache
> them into tmp files.
>
> Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
> Reviewed-by: Zhang Xiaohe <zhangxh@cn.fujitsu.com>
> ---
> + db->file_name = (char *)g_malloc(strlen(filename) + strlen(tmpname) + 1);
> +
> + strcpy(db->file_name, tmpname);
> + strcat(db->file_name, "/");
> + strcat(db->file_name, filename);
Off-by-one buffer overflow, since you forgot space for the NUL byte. We
use C, not C++, so you don't need to cast the result of g_malloc().
> +++ b/include/dump_bitmap.h
> @@ -0,0 +1,57 @@
> +/*
> + * QEMU dump bitmap
> + *
> + * Copyright Fujitsu, Corp. 2013
> + *
> + * Authors:
> + * Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + *
> + */
> +
No double-inclusion guard?
> +#define TMP_DIR "/tmp"
Why not reuse P_tmpdir from <stdio.h> instead of reinventing a new name
for this constant?
> +#define BITPERBYTE (8)
Why not use CHAR_BIT from <limits.h> instead of reinventing a new name
for this constant?
> +#define BUFSIZE_BITMAP (4096)
> +#define PFN_BUFBITMAP (BITPERBYTE * BUFSIZE_BITMAP)
> +
> +struct dump_bitmap {
> + int fd; /* fd of the tmp file used to store dump bitmap */
> + int no_block; /* number of block cached in buf */
Trailing whitespace. Run your patch series through scripts/checkpatch.pl.
The name no_block sounds like there aren't any blocks. You probably
want the name num_block instead.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]
next prev parent reply other threads:[~2013-05-07 16:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-07 7:16 [Qemu-devel] [PATCH 0/9] Make monitor command 'dump-guest-memory' dump in kdump-compressed format Qiao Nuohan
2013-05-07 7:16 ` [Qemu-devel] [PATCH 1/9] Add API to manipulate dump_bitmap Qiao Nuohan
2013-05-07 16:14 ` Eric Blake [this message]
2013-05-07 16:23 ` Daniel P. Berrange
2013-05-08 8:39 ` qiaonuohan
2013-05-07 7:16 ` [Qemu-devel] [PATCH 2/9] Add API to manipulate cache_data Qiao Nuohan
2013-05-07 7:16 ` [Qemu-devel] [PATCH 3/9] Move include and struct definition to dump.h Qiao Nuohan
2013-05-11 13:36 ` Andreas Färber
2013-05-07 7:16 ` [Qemu-devel] [PATCH 4/9] Add API to create header of vmcore Qiao Nuohan
2013-05-07 7:16 ` [Qemu-devel] [PATCH 5/9] Add API to create data of dump bitmap Qiao Nuohan
2013-05-07 7:16 ` [Qemu-devel] [PATCH 6/9] Add API to create page Qiao Nuohan
2013-05-07 7:16 ` [Qemu-devel] [PATCH 7/9] Add API to free buf used by creating header, bitmap and page Qiao Nuohan
2013-05-07 7:16 ` [Qemu-devel] [PATCH 8/9] Add API to write header, bitmap and page into vmcore Qiao Nuohan
2013-05-07 7:16 ` [Qemu-devel] [PATCH 9/9] Make monitor command 'dump-guest-memory' dump in kdump-compressed format Qiao Nuohan
2013-05-07 17:13 ` Eric Blake
2013-05-08 8:50 ` qiaonuohan
2013-05-08 17:16 ` Eric Blake
2013-05-09 5:27 ` Zhang Xiaohe
2013-05-09 14:51 ` Eric Blake
2013-05-10 1:21 ` Zhang Xiaohe
2013-05-08 9:03 ` [Qemu-devel] [PATCH 0/9] " HATAYAMA Daisuke
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=51892853.8040001@redhat.com \
--to=eblake@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qiaonuohan@cn.fujitsu.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.