From patchwork Fri Mar 11 12:32:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 8565331 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 55D9A9F38C for ; Fri, 11 Mar 2016 12:33:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC4CF20340 for ; Fri, 11 Mar 2016 12:33:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1370920268 for ; Fri, 11 Mar 2016 12:33:01 +0000 (UTC) Received: from localhost ([::1]:54512 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeMFY-0000HU-EM for patchwork-qemu-devel@patchwork.kernel.org; Fri, 11 Mar 2016 07:33:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeMFK-0000C2-2p for qemu-devel@nongnu.org; Fri, 11 Mar 2016 07:32:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeMFE-0007nz-GZ for qemu-devel@nongnu.org; Fri, 11 Mar 2016 07:32:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60682) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeMFE-0007ng-C1 for qemu-devel@nongnu.org; Fri, 11 Mar 2016 07:32:40 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 08EA0C00B8CE; Fri, 11 Mar 2016 12:32:40 +0000 (UTC) Received: from localhost (ovpn-113-127.phx2.redhat.com [10.3.113.127]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2BCWcTZ001846; Fri, 11 Mar 2016 07:32:39 -0500 From: Amit Shah To: Peter Maydell Date: Fri, 11 Mar 2016 18:02:11 +0530 Message-Id: <568b01caf38a5e156c2dc58ea002daa4e2dcab20.1457699452.git.amit.shah@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Juan Quintela , qemu list , peterx@redhat.com, "Dr. David Alan Gilbert" , Amit Shah , den@openvz.org Subject: [Qemu-devel] [PULL 1/4] migration: fix warning for source_return_path_thread X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Xu max_len is not necessary, while it brings a warning during compilation when specify "-Wstack-usage=1000000". Replacing using sizeof(). Signed-off-by: Peter Xu Message-Id: <1457503932-31763-1-git-send-email-peterx@redhat.com> Signed-off-by: Amit Shah --- migration/migration.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 7d13377..a858159 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1269,8 +1269,7 @@ static void *source_return_path_thread(void *opaque) MigrationState *ms = opaque; QEMUFile *rp = ms->rp_state.from_dst_file; uint16_t header_len, header_type; - const int max_len = 512; - uint8_t buf[max_len]; + uint8_t buf[512]; uint32_t tmp32, sibling_error; ram_addr_t start = 0; /* =0 to silence warning */ size_t len = 0, expected_len; @@ -1293,7 +1292,7 @@ static void *source_return_path_thread(void *opaque) if ((rp_cmd_args[header_type].len != -1 && header_len != rp_cmd_args[header_type].len) || - header_len > max_len) { + header_len > sizeof(buf)) { error_report("RP: Received '%s' message (0x%04x) with" "incorrect length %d expecting %zu", rp_cmd_args[header_type].name, header_type, header_len,