From patchwork Fri Sep 9 20:37:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashijeet Acharya X-Patchwork-Id: 9324351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 82D0860231 for ; Fri, 9 Sep 2016 20:39:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 761732A013 for ; Fri, 9 Sep 2016 20:39:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6AE0A2A016; Fri, 9 Sep 2016 20:39:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 0AFA12A013 for ; Fri, 9 Sep 2016 20:39:47 +0000 (UTC) Received: from localhost ([::1]:60107 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biSaQ-0001wf-4Q for patchwork-qemu-devel@patchwork.kernel.org; Fri, 09 Sep 2016 16:39:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biSYx-00014z-UE for qemu-devel@nongnu.org; Fri, 09 Sep 2016 16:38:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1biSYr-0006NR-Tc for qemu-devel@nongnu.org; Fri, 09 Sep 2016 16:38:14 -0400 Received: from mail-pa0-x242.google.com ([2607:f8b0:400e:c03::242]:35597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biSYr-0006NN-MJ for qemu-devel@nongnu.org; Fri, 09 Sep 2016 16:38:09 -0400 Received: by mail-pa0-x242.google.com with SMTP id pp5so4273344pac.2 for ; Fri, 09 Sep 2016 13:38:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=I8peg7ZB74fkCDrVYcqhq02R6vV824KQgS6kE5A9Afg=; b=K1iey0+pTy01HQ3h8+l1xCUiyixYdJf4qRoczbTCx0HlZge6WlJQGrjAUj2lAS/PZx shEPzpmrGiv7sVTrIV0lY877wg6O25cCxHJI7oRytuHEBImOrdTs28/lhPP523aE0jPZ 3i8H3T/XhvmbGT0Z06UXJLk2srqzjYwW5ByIHXfMWQxiGr2L/8+d/6m4USQp9GAAVtvf SCkMudzOSuH51j9TRl4Ku2/aXfNwOgeKpGFu7QUQcNrx5Gv1LECjC8qy7PMGLGsrtb3D d7s+Zoaw30f9kLYurKtwEUeDIhBDHnbWofe7X1mKF6XXyjIU4EIyN5gXh+jniLVdBL6o fuSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=I8peg7ZB74fkCDrVYcqhq02R6vV824KQgS6kE5A9Afg=; b=D5Rf1HLwkf5yusBo9kqxhl2T3w4VjJdKYPyAtKsR3MV3bw39Imz/iu4pL+utuy1gC8 FwrpQt9XWJtmt7bYyNqhy62RgZ+apm89cRTafKCO0yu1rgdz2SeFy9R3yB1/IhVaGOJy Fzj9KR/45O+nmtC2arH4kWufMeETUZS9XhS1I/QdhEoJeQN2496DDgslr6A4hT2zJreY NXeaHgTOR849Vnfi+wXTwunvv8RsEz4iqRtMBzjYAXUXYb0ITssotPbO/IDN3E3QUlZ5 BYx6P7vFwwUqyow2T+TW7HB1g0Q0AjpYgndw7nCSDAPE3UiB27X1KbEdzMTUmt89wVbU MKsQ== X-Gm-Message-State: AE9vXwNkc3dHTk/l7NL0GPRoHZTbMPXl8DRnfEtzc7zIZhYpI3M0bOdkyCXDWPnGpHLXHA== X-Received: by 10.66.245.177 with SMTP id xp17mr9946034pac.118.1473453488910; Fri, 09 Sep 2016 13:38:08 -0700 (PDT) Received: from linux.local ([106.208.12.73]) by smtp.gmail.com with ESMTPSA id y2sm7275666pan.31.2016.09.09.13.38.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Sep 2016 13:38:08 -0700 (PDT) From: Ashijeet Acharya To: quintela@redhat.com Date: Sat, 10 Sep 2016 02:07:04 +0530 Message-Id: <1473453424-601-1-git-send-email-ashijeetacharya@gmail.com> X-Mailer: git-send-email 2.6.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c03::242 Subject: [Qemu-devel] [PATCH v3] migrate: Fix bounds check for migration parameters in migration.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: amit.shah@redhat.com, dgilbert@redhat.com, Ashijeet Acharya , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes the out-of-bounds check of migration parameters in qmp_migrate_set_parameters() for cpu-throttle-initial and cpu-throttle-increment by adding a return statement for both as they were broken since their introduction in 2.5 via commit 1626fee. Due to the missing return statements, parameters were getting set to out-of-bounds values despite the error. Signed-off-by: Ashijeet Acharya --- migration/migration.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index 9b4aa55..cd8334c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -805,6 +805,7 @@ void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_initial", "an integer in the range of 1 to 99"); + return; } if (params->has_cpu_throttle_increment && (params->cpu_throttle_increment < 1 || @@ -812,6 +813,7 @@ void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_increment", "an integer in the range of 1 to 99"); + return; } if (params->has_max_bandwidth && (params->max_bandwidth < 0 || params->max_bandwidth > SIZE_MAX)) {