Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C235C4345F for ; Mon, 29 Apr 2024 15:04:55 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.714164.1115241 (Exim 4.92) (envelope-from ) id 1s1SYg-0003ag-S4; Mon, 29 Apr 2024 15:04:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 714164.1115241; Mon, 29 Apr 2024 15:04:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s1SYg-0003aZ-PT; Mon, 29 Apr 2024 15:04:46 +0000 Received: by outflank-mailman (input) for mailman id 714164; Mon, 29 Apr 2024 15:04:45 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s1SYf-0003aL-7M for xen-devel@lists.xenproject.org; Mon, 29 Apr 2024 15:04:45 +0000 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [2a00:1450:4864:20::336]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id cf9b92a6-0639-11ef-909b-e314d9c70b13; Mon, 29 Apr 2024 17:04:44 +0200 (CEST) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-41b869326daso21651515e9.0 for ; Mon, 29 Apr 2024 08:04:44 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id u14-20020a05600c19ce00b0041c23148330sm5662118wmq.10.2024.04.29.08.04.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Apr 2024 08:04:43 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: cf9b92a6-0639-11ef-909b-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1714403083; x=1715007883; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=3U4gnMWSmqa0xD6keYH4jurkcji37IsVDBGhTNv4OQI=; b=dQGw7nZmWdPkxQlLXnCYnah2TUXh1XKJFi9XDtxVemRSREz4PC/AAlamvHol6dW7Oj /S6SXP8KTD9uymbZBsDaBoQpvCluAmQp02TX/fQ6ZdPpICDKgNQri0S2RxV9W8SyRRTm 3lvxd8G6AVSDaMBDh0Cw+czNW7Das4YeKKNIeaDAA+jPf6HIz5pGRgod4aIbsJ9wC04a FO4brHqXovYOh6ZJv2VHeqVRWV/XlSupc6Lg9tu/4ipRnonmgwGH2JyP4KlsZspA32HL F0xoS2IP636vDPqKYuWdY2WT7SHCjFoOU49INp+6jfOaaEPwBQm+JCX6Umg7Qg1FmuAz mh8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714403083; x=1715007883; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3U4gnMWSmqa0xD6keYH4jurkcji37IsVDBGhTNv4OQI=; b=YkL1sEgRppclh5slMTsY1eOy7INy6ifTLDnNr6Q4MqA0hp3y9WKUV+5A19Mjl+IhAg Xy8CGupBTeDmj9lBTb7NqQUij/oHWhUzo+fb2DqZ8yalP0jDeECh+yTy4I3k0b9yopLJ f4ie3QX+/iEdlMnJnjPS3u+v8hpfroSvzn/Zfjv7bsI5oDnP0fyS1zPsJk+IaX2dPqT+ cp+WMuMHb/WGD6aIop61MJYdDBRB6Dtt+vj07RWmAWydUWAP7w69ARHEgf7WEnWyteEf dTGa9CNPq9OXDYPwsxkdtq29YWZmne5eVdIMnYqKTzhXdJkN4bOUoXzdHIa1CcfBb5UI 8HUg== X-Forwarded-Encrypted: i=1; AJvYcCWBYWCVC401ZbrkuskCasvkiU4SFR5k+WDERm6jyrQ+NouPh8kXIbAwW5tBMbNtXvCx0Yn+60nHQbMJb9kyKDeXXpZb+8j5ty9ZIMAdva8= X-Gm-Message-State: AOJu0YztnIm7cCVOXwnI12lsw9xlA36+i1Vk2HVoh8aETb+7O7srwmZH hC2aNqFO7EbOsao0EWVssHxEECVx67tJ0YKc9rewmjdL7+cSj+PCqOi6BeyXfQ== X-Google-Smtp-Source: AGHT+IG5NEF+E4jOmXqKiZqSl02hVPv7ehyG6crkx2USDjUAVmzgCKR1FuUJpARwsM5tPUFzAxRgjw== X-Received: by 2002:a05:600c:3c90:b0:417:caa8:c3f4 with SMTP id bg16-20020a05600c3c9000b00417caa8c3f4mr9380890wmb.34.1714403083351; Mon, 29 Apr 2024 08:04:43 -0700 (PDT) Message-ID: Date: Mon, 29 Apr 2024 17:04:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 5/8] gzip: move input buffer handling into gunzip state Content-Language: en-US To: "Daniel P. Smith" Cc: Jason Andryuk , Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , xen-devel@lists.xenproject.org References: <20240424163422.23276-1-dpsmith@apertussolutions.com> <20240424163422.23276-6-dpsmith@apertussolutions.com> From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507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v+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <20240424163422.23276-6-dpsmith@apertussolutions.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 24.04.2024 18:34, Daniel P. Smith wrote: > --- a/xen/common/gzip/gunzip.c > +++ b/xen/common/gzip/gunzip.c > @@ -10,13 +10,12 @@ struct gunzip_state { > unsigned char *window; > /* window pointer: */ > unsigned int wp; > -}; > - > -static unsigned char *__initdata inbuf; > -static unsigned int __initdata insize; > > -/* Index of next byte to be processed in inbuf: */ > -static unsigned int __initdata inptr; > + unsigned char *inbuf; > + size_t insize; > + /* Index of next byte to be processed in inbuf: */ > + unsigned int inptr; I'm puzzled by the (suddenly) different types, seeing that ... > +}; > > #define malloc(a) xmalloc_bytes(a) > #define free(a) xfree(a) > @@ -51,14 +50,14 @@ static __init void error(const char *x) > panic("%s\n", x); > } > > -static __init uch get_byte(void) { > - if ( inptr >= insize ) > +static __init uch get_byte(struct gunzip_state *s) { > + if ( s->inptr >= s->insize ) ... both are compared with one another. > @@ -1129,29 +1129,29 @@ static int __init gunzip(struct gunzip_state *s) > error("Input has invalid flags"); > return -1; > } > - NEXTBYTE(); /* Get timestamp */ > - NEXTBYTE(); > - NEXTBYTE(); > - NEXTBYTE(); > + NEXTBYTE(s); /* Get timestamp */ > + NEXTBYTE(s); > + NEXTBYTE(s); > + NEXTBYTE(s); > > - NEXTBYTE(); /* Ignore extra flags for the moment */ > - NEXTBYTE(); /* Ignore OS type for the moment */ > + NEXTBYTE(s); /* Ignore extra flags for the moment */ > + NEXTBYTE(s); /* Ignore OS type for the moment */ > > if ((flags & EXTRA_FIELD) != 0) { > - unsigned len = (unsigned)NEXTBYTE(); > - len |= ((unsigned)NEXTBYTE())<<8; > - while (len--) (void)NEXTBYTE(); > + unsigned len = (unsigned)NEXTBYTE(s); > + len |= ((unsigned)NEXTBYTE(s))<<8; > + while (len--) (void)NEXTBYTE(s); Would you mind moving the body of this while() to its own line, as you touch this anyway? > } > > /* Get original file name if it was truncated */ > if ((flags & ORIG_NAME) != 0) { > /* Discard the old name */ > - while (NEXTBYTE() != 0) /* null */ ; > + while (NEXTBYTE(s) != 0) /* null */ ; > } > > /* Discard file comment if any */ > if ((flags & COMMENT) != 0) { > - while (NEXTBYTE() != 0) /* null */ ; > + while (NEXTBYTE(s) != 0) /* null */ ; > } For these two doing the same may help, too. Jan