From patchwork Thu Jan 15 08:30:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 43144 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f199.google.com (mail-we0-f199.google.com [74.125.82.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2C12E240BA for ; Thu, 15 Jan 2015 08:40:41 +0000 (UTC) Received: by mail-we0-f199.google.com with SMTP id k11sf7141090wes.2 for ; Thu, 15 Jan 2015 00:40:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=dvFf1DaSqftd9HXQZkjRsi85NozJo+V8DIgW37PKVD4=; b=HkJmNhk6KqASk8nkhD5Dh6JoQDRtsP/o73NK3ZoRYf5ihrYrP/1JTGlUjQJYLqBusB yV3gPikKoA3gFQMwwVXzS5iTL+1xgd52j/rzysHIqCTliE5/z2wSAem/l5gbu6REagl5 dUijzWyKJa6g0DnuxusbN2bKyxfG87Y8MF/bi6rUVRbeNrz09/2rO0Dllbbup5E1tvZh nYQI/ZVD2LSWC5hJfIR7rmggGVRois1ppf38nqHNuxSKVb2GlwETuG27WJUyrIjf5RNw 0Og2MtioV+QpepHOG2O7jLOhQ6p8MA0uQ4TPsA7jHf7NXyPMFrW5HTuWWGYoHZ7M2jO5 vgxw== X-Gm-Message-State: ALoCoQlFmYI9K4M822saBS4IeyCwnN3eUbXCVX9SKqKP4d/hLIwUoDHVqhrAHcU8EN5S4lkgVnAj X-Received: by 10.152.181.138 with SMTP id dw10mr289696lac.1.1421311240398; Thu, 15 Jan 2015 00:40:40 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.7 with SMTP id f7ls211810laa.100.gmail; Thu, 15 Jan 2015 00:40:40 -0800 (PST) X-Received: by 10.152.234.9 with SMTP id ua9mr8336279lac.44.1421311240000; Thu, 15 Jan 2015 00:40:40 -0800 (PST) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id ua8si805425lac.7.2015.01.15.00.40.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Jan 2015 00:40:39 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id p9so12106725lbv.7 for ; Thu, 15 Jan 2015 00:40:39 -0800 (PST) X-Received: by 10.152.6.132 with SMTP id b4mr8437855laa.59.1421311239913; Thu, 15 Jan 2015 00:40:39 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp1959168lbb; Thu, 15 Jan 2015 00:40:39 -0800 (PST) X-Received: by 10.224.89.2 with SMTP id c2mr13915205qam.75.1421311238679; Thu, 15 Jan 2015 00:40:38 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s18si1203324qam.4.2015.01.15.00.40.38 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 15 Jan 2015 00:40:38 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:49544 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBfyn-0007jG-PW for patch@linaro.org; Thu, 15 Jan 2015 03:40:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBfxD-0005gX-Qg for qemu-devel@nongnu.org; Thu, 15 Jan 2015 03:39:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YBfx9-0002Fh-5f for qemu-devel@nongnu.org; Thu, 15 Jan 2015 03:38:59 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:42181) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBfx8-0002EK-U9; Thu, 15 Jan 2015 03:38:55 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id D3F1D40DB3; Thu, 15 Jan 2015 11:38:53 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id 7D3F38CE; Thu, 15 Jan 2015 11:30:54 +0300 (MSK) Received: (nullmailer pid 31347 invoked by uid 1000); Thu, 15 Jan 2015 08:30:51 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Thu, 15 Jan 2015 11:30:42 +0300 Message-Id: <90d6a6730b4dbe7d0ada9900aba8263d61376812.1421310394.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 86.62.121.231 Cc: qemu-trivial@nongnu.org, Peter Maydell , Michael Tokarev Subject: [Qemu-devel] [PULL 04/12] migration/qemu-file.c: Don't shift left into sign bit 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mjt@tls.msk.ru X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Peter Maydell Add a cast in qemu_get_be32() to avoid shifting left into the sign bit of a signed integer (which is undefined behaviour in C). Signed-off-by: Peter Maydell Signed-off-by: Michael Tokarev --- migration/qemu-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index d2d4007..a7f2a34 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -503,7 +503,7 @@ unsigned int qemu_get_be16(QEMUFile *f) unsigned int qemu_get_be32(QEMUFile *f) { unsigned int v; - v = qemu_get_byte(f) << 24; + v = (unsigned int)qemu_get_byte(f) << 24; v |= qemu_get_byte(f) << 16; v |= qemu_get_byte(f) << 8; v |= qemu_get_byte(f);