From patchwork Fri Mar 28 15:12:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 27304 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2F44120545 for ; Fri, 28 Mar 2014 15:13:01 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id ur14sf2448287igb.1 for ; Fri, 28 Mar 2014 08:13:01 -0700 (PDT) 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:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=qWRGRHFRscLcMyyTwEIVYCpElGhfV/+PDWYBRAPZzC0=; b=KIoH0pdkSmidLj54GaSqQdPWrIE9Zm6ZtjQRkU1a02DoytflVsHPKw1MCcf19QnaJh QiFVusWzGpyQyUARowsdiWuIVfZWp9evH/oIyb9+4XWJyf7sXtqPA2g+SWJ1ei5QTHSK ydpzNb5btDFlXXVemW+H6laSjOaBZPXlNR53YxI1++/CR/dDlEWXSOuDaOgNW3X95l// kCMWso4laDnPmIWHz0oToGf1ukuF2NTejipv4/v4AtcT9WU+vrVOp14BCDjnfoUdRdWG ocpWbdzYKptQEe7rLrvIlA7h9wTvcDnkdFcBWDn/SmXJv710jMV8k1hQPwd0+5q7a515 qbUA== X-Gm-Message-State: ALoCoQmGBinsO8AyCBEj5SrntwdeSfGPdQxerwfDFpWlDAroBpz2FtPP+t9mgKccKo3CBMWHhlRh X-Received: by 10.42.87.140 with SMTP id y12mr2785840icl.31.1396019581110; Fri, 28 Mar 2014 08:13:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.39.133 with SMTP id v5ls1504429qgv.23.gmail; Fri, 28 Mar 2014 08:13:01 -0700 (PDT) X-Received: by 10.52.242.167 with SMTP id wr7mr825098vdc.32.1396019580975; Fri, 28 Mar 2014 08:13:00 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id xt10si1291704veb.112.2014.03.28.08.13.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 08:13:00 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 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.182; Received: by mail-vc0-f182.google.com with SMTP id ks9so5944713vcb.41 for ; Fri, 28 Mar 2014 08:13:00 -0700 (PDT) X-Received: by 10.58.90.99 with SMTP id bv3mr18143veb.34.1396019580839; Fri, 28 Mar 2014 08:13:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.12.8 with SMTP id v8csp16205vcv; Fri, 28 Mar 2014 08:13:00 -0700 (PDT) X-Received: by 10.15.44.3 with SMTP id y3mr3499816eev.58.1396019579386; Fri, 28 Mar 2014 08:12:59 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id y6si8832852eep.257.2014.03.28.08.12.58 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 28 Mar 2014 08:12:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WTYSn-0000Wz-Sc; Fri, 28 Mar 2014 15:12:57 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, qemu-trivial@nongnu.org Subject: [PATCH 1/3] hw/ide/ahci.c: Avoid shift left into sign bit Date: Fri, 28 Mar 2014 15:12:55 +0000 Message-Id: <1396019577-2013-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1396019577-2013-1-git-send-email-peter.maydell@linaro.org> References: <1396019577-2013-1-git-send-email-peter.maydell@linaro.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.182 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add U suffix to avoid shifting left into the sign bit, which is undefined behaviour. Signed-off-by: Peter Maydell --- hw/ide/ahci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index bfe633f..50327ff 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -438,9 +438,9 @@ static void check_cmd(AHCIState *s, int port) if ((pr->cmd & PORT_CMD_START) && pr->cmd_issue) { for (slot = 0; (slot < 32) && pr->cmd_issue; slot++) { - if ((pr->cmd_issue & (1 << slot)) && + if ((pr->cmd_issue & (1U << slot)) && !handle_cmd(s, port, slot)) { - pr->cmd_issue &= ~(1 << slot); + pr->cmd_issue &= ~(1U << slot); } } }