From patchwork Wed Feb 26 18:01:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 25389 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0EBCD20636 for ; Wed, 26 Feb 2014 18:19:38 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id x10sf2881885pdj.6 for ; Wed, 26 Feb 2014 10:19:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version: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:content-type :content-transfer-encoding; bh=bgIuF/jUfPEg7Ac7bHjrUK1TAH6sclAKb9h0XVQqVvY=; b=RSSPVy2jQOkZLQEQyJF/zxPujhqEkfHVCWC0l0+e1wJnQgvV3g1BrQW5ZP1SpGv56A JN1SbZoRGj+UCFPUYKvjGGVANt7PzJS8XsCulkzeJEMdLoBLyww22KvyIQdykJTPG6gW wCEHEaPplig4m9AofgCvo1ArYEwc0UuzscCmHjf9NK3xBH/OTuCfmw7hFJpsbEa+3BCo A635jWbTOXVTJLi4stACicOHVXmSmyttw8NjCRdfTIqCL3rDLoy+c0ORo6EZEu9xT6Ha Jjt10NwvFSsfyyzzBxqLSqVBZ/0Q0VMC6H5TAngd9ccqS117ZFvripRbZsOFIuUEstDb +4TQ== X-Gm-Message-State: ALoCoQnBInZta3KlG89lctnhT+8uvdaKRT9PuQkYh5AluuuLRhyZFmftbktnebqiMy6YeQYcwmlK X-Received: by 10.66.172.103 with SMTP id bb7mr3797690pac.44.1393438778285; Wed, 26 Feb 2014 10:19:38 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.83.75 with SMTP id i69ls303168qgd.66.gmail; Wed, 26 Feb 2014 10:19:38 -0800 (PST) X-Received: by 10.58.48.133 with SMTP id l5mr966316ven.36.1393438778062; Wed, 26 Feb 2014 10:19:38 -0800 (PST) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id ry8si207806vdc.32.2014.02.26.10.19.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Feb 2014 10:19:38 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id lg15so1340495vcb.12 for ; Wed, 26 Feb 2014 10:19:38 -0800 (PST) X-Received: by 10.58.186.132 with SMTP id fk4mr6846371vec.9.1393438777979; Wed, 26 Feb 2014 10:19:37 -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.220.174.196 with SMTP id u4csp45471vcz; Wed, 26 Feb 2014 10:19:37 -0800 (PST) X-Received: by 10.140.96.116 with SMTP id j107mr1444508qge.6.1393438775040; Wed, 26 Feb 2014 10:19:35 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l52si488140qge.35.2014.02.26.10.19.34 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 26 Feb 2014 10:19:35 -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]:42337 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIj4w-00048w-Fx for patch@linaro.org; Wed, 26 Feb 2014 13:19:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIior-00012F-Mq for qemu-devel@nongnu.org; Wed, 26 Feb 2014 13:02:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WIioq-0007Ri-SB for qemu-devel@nongnu.org; Wed, 26 Feb 2014 13:02:57 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:46191) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIioq-0007Eu-MZ for qemu-devel@nongnu.org; Wed, 26 Feb 2014 13:02:56 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WIioV-000690-Dz; Wed, 26 Feb 2014 18:02:35 +0000 From: Peter Maydell To: Anthony Liguori Date: Wed, 26 Feb 2014 18:01:52 +0000 Message-Id: <1393437755-23586-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1393437755-23586-1-git-send-email-peter.maydell@linaro.org> References: <1393437755-23586-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: Blue Swirl , qemu-devel@nongnu.org, Aurelien Jarno Subject: [Qemu-devel] [PULL 02/45] hw/net/stellaris_enet: Avoid unintended sign extension 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: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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 Add a cast to avoid an unintended sign extension that would mean we returned 0xffffffff in the high 32 bits for an IA0 read if bit 31 in the MAC address was 1. (This is harmless since we'll only be doing 4 byte reads, but it could be confusing, so best avoided.) Signed-off-by: Peter Maydell Reviewed-by: Paolo Bonzini Reviewed-by: Andreas Färber Message-id: 1392647854-8067-3-git-send-email-peter.maydell@linaro.org --- hw/net/stellaris_enet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/net/stellaris_enet.c b/hw/net/stellaris_enet.c index 9dd77f7..d04e6a4 100644 --- a/hw/net/stellaris_enet.c +++ b/hw/net/stellaris_enet.c @@ -176,7 +176,8 @@ static uint64_t stellaris_enet_read(void *opaque, hwaddr offset, return val; case 0x14: /* IA0 */ return s->conf.macaddr.a[0] | (s->conf.macaddr.a[1] << 8) - | (s->conf.macaddr.a[2] << 16) | (s->conf.macaddr.a[3] << 24); + | (s->conf.macaddr.a[2] << 16) + | ((uint32_t)s->conf.macaddr.a[3] << 24); case 0x18: /* IA1 */ return s->conf.macaddr.a[4] | (s->conf.macaddr.a[5] << 8); case 0x1c: /* THR */