From patchwork Tue Aug 5 09:57:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 34905 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 193D120523 for ; Tue, 5 Aug 2014 10:03:54 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id v1sf2336422yhn.4 for ; Tue, 05 Aug 2014 03:03:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:references:from:to:date:in-reply-to :message-id: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=H+cS0mgnNpIMuB4B058U5TdX5aPtY1hRJCmNOQAPakg=; b=Sk2gY0zgbloPD07x6wfs5PH9qGQC+yMrpTUCjk0f7iwOKH7FI9wed9FCX2BUNY/9mg A+rlnffYkPUxkGj67L+X9WF4/K4HxcmEUY85VNE+kQz9wWYRuiP1MyW9LxDnHqdQmq5D zuvnbEKPiT5eU28EFdvvfdbMGuDUozqGq5KfPjIqj6iCiPd93lo6Y+YxNxFEbrZd4XNC BWxBfHucrEmFKJhnl62FhT3xiYOoRLUiuzYQ+GwMOxWJ4sycUFvjqMM7UNBaXuejLX4V 3iTG29UHr1LQ3P/WD9uvfMpP+yD8Yek/KxoHdddg3CDxmX1goeyI7SGrYMBJxQpf0Lm3 wrww== X-Gm-Message-State: ALoCoQkc1wbSSBMwIrkTAAJp0ojiAu//BQhrt5xUZe3v24jsjQocOGcGRYwvf8dXMYR0etENCmV7 X-Received: by 10.236.105.197 with SMTP id k45mr1393192yhg.19.1407233033928; Tue, 05 Aug 2014 03:03:53 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.100.214 with SMTP id s80ls193986qge.99.gmail; Tue, 05 Aug 2014 03:03:53 -0700 (PDT) X-Received: by 10.221.41.135 with SMTP id tu7mr219817vcb.70.1407233033797; Tue, 05 Aug 2014 03:03:53 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id u2si720788vdx.74.2014.08.05.03.03.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Aug 2014 03:03:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hq11so1041832vcb.10 for ; Tue, 05 Aug 2014 03:03:53 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr2288179vcb.0.1407233033728; Tue, 05 Aug 2014 03:03:53 -0700 (PDT) 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.221.37.5 with SMTP id tc5csp371706vcb; Tue, 5 Aug 2014 03:03:53 -0700 (PDT) X-Received: by 10.140.49.201 with SMTP id q67mr3562897qga.7.1407233033025; Tue, 05 Aug 2014 03:03:53 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n105si1979880qga.24.2014.08.05.03.03.52 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 05 Aug 2014 03:03:53 -0700 (PDT) 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]:58334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEbay-0004Eo-KM for patch@linaro.org; Tue, 05 Aug 2014 06:03:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEbZp-00033d-0K for qemu-devel@nongnu.org; Tue, 05 Aug 2014 06:02:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEbZi-0002JR-SE for qemu-devel@nongnu.org; Tue, 05 Aug 2014 06:02:40 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:47458 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEbXW-0001YH-GR for qemu-devel@nongnu.org; Tue, 05 Aug 2014 06:00:18 -0400 Received: from localhost ([127.0.0.1] helo=zen.linaro.local) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1XEbiU-0007z4-QA; Tue, 05 Aug 2014 12:11:38 +0200 References: <1407152873-16772-1-git-send-email-rjones@redhat.com> <1407152873-16772-2-git-send-email-rjones@redhat.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= To: "Richard W.M. Jones" Date: Tue, 05 Aug 2014 10:57:26 +0100 In-reply-to: <1407152873-16772-2-git-send-email-rjones@redhat.com> Message-ID: <874mxrl0hz.fsf@linaro.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: alex.bennee@linaro.org X-SA-Exim-Scanned: No (on socrates.bennee.com); SAEximRunCond expanded to false X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 88.198.71.155 Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, qemu-devel@nongnu.org Subject: Re: [Qemu-devel] [PATCH v5 1/2] loader: Add load_image_gzipped function. 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: alex.bennee@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 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 Richard W.M. Jones writes: > As the name suggests this lets you load a ROM/disk image that is > gzipped. It is uncompressed before storing it in guest memory. > > Signed-off-by: Richard W.M. Jones > + /* Is it a gzip-compressed file? */ > + if (len < 2 || > + compressed_data[0] != '\x1f' || > + compressed_data[1] != '\x8b') { > + goto out; > + } Hmm serves me right for not compiling this first. I had to explicit literals to get this to compile: Modified hw/core/loader.c Otherwise I get: hw/core/loader.c: In function ‘load_image_gzipped’: hw/core/loader.c:603:9: error: comparison is always true due to limited range of data type [-Werror=type-limits] compressed_data[1] != '\x8b') { diff --git a/hw/core/loader.c b/hw/core/loader.c index e773aab..83136e8 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -599,8 +599,8 @@ int load_image_gzipped(const char *filename, hwaddr addr, uint64_t max_sz) /* Is it a gzip-compressed file? */ if (len < 2 || - compressed_data[0] != '\x1f' || - compressed_data[1] != '\x8b') { + compressed_data[0] != 0x1f || + compressed_data[1] != 0x8b ) { goto out; }