Received: by 10.213.65.68 with SMTP id h4csp1313530imn; Wed, 14 Mar 2018 16:47:26 -0700 (PDT) X-Google-Smtp-Source: AG47ELs7hZ4XXBQRJqiLCLFyEtlzPAec8/ssGyiiQRSbFQ++5D4jPEgkfaK3YC2DwpelA9KiXUou X-Received: by 10.98.15.72 with SMTP id x69mr5860305pfi.16.1521071246124; Wed, 14 Mar 2018 16:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521071246; cv=none; d=google.com; s=arc-20160816; b=WQOvBRuwFODCZKkJUEQC8kfcI0Dr8ANChQV4/7lWQSzorO34rfaJZ7ltxT3w2/lVv9 1m7KDMtdHcyspZr9UOhlSQtwEvK0FIkKi5ZU2vPvb8tGVSkqICSwg9sGdvB9PZX5DclZ UuzM6yJdFtVBF5JtvnCqLnaxCeWec7MkmTQv5RmoM32MqKISyTaXKjsNVcRhbPRwZvMJ nyk6BxiYh5c7OGsG4m6U6v+8ZaLp7yWXcVfgGZAq3wceCdBxWPcFKkdnquilDhJEIwBO m7YneW4nJC0cLx+MZksHPhNw18CzEwZQhCq+jZCBL3ys2X5cl3sG+gX3mxd53klqkHTS ETgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=N69dxR5XnOZP5H1Vm8ci4tCqEByNwpsxmMzJ4bjbOWM=; b=0Y96LM7cmVdBOMRq42ltr0AjhLtvbDjqolYSdMHwvqZ0gxUpgasb8xvprc8oZb3CqG ogqMIYP6Ol26ZzE3Y+wNRmJ6oez3opN2Ei1ONC1YCwG8Fbm6YcirrHJlWfEu9i+6LP3Y fWUA3nrbMGtwngAFlCoeeKrRJQ2LGfguOfE+JltEX5WJfpukeg+pcWBAm2dylhjxYy0D n5chxG/iHsSSvUCXPPbqIQ9FMQ9EX1k8gbG+ccdn3nhS+pesqSw9J0WcoVXqE6t6e7PZ YTloTYtrJJFvLDWVew1AIljsLQ/MhkeMBVvQzVc0WolrxD9qK5WyzuCwuA0u11wQzlbp 0Y3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h125si2895038pfc.133.2018.03.14.16.47.11; Wed, 14 Mar 2018 16:47:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751657AbeCNXqK (ORCPT + 99 others); Wed, 14 Mar 2018 19:46:10 -0400 Received: from vps-vb.mhejs.net ([37.28.154.113]:52806 "EHLO vps-vb.mhejs.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751348AbeCNXqJ (ORCPT ); Wed, 14 Mar 2018 19:46:09 -0400 Received: by vps-vb.mhejs.net with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ewG5u-0002J6-C9; Thu, 15 Mar 2018 00:46:06 +0100 Subject: Re: [PATCH v3 3/9] x86/microcode/AMD: install_equiv_cpu_table() should not return (signed) int To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org References: <20180314175824.GG16605@pd.tnic> From: "Maciej S. Szmigiero" Message-ID: Date: Thu, 15 Mar 2018 00:46:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180314175824.GG16605@pd.tnic> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14.03.2018 18:58, Borislav Petkov wrote: > On Tue, Mar 13, 2018 at 10:06:34PM +0100, Maciej S. Szmigiero wrote: >> The maximum possible value returned by install_equiv_cpu_table() is >> UINT_MAX + CONTAINER_HDR_SZ (on a 64-bit kernel). >> This is more than (signed) int type currently returned by this function can >> hold so this function will need to return a size_t instead. > > I'm trying to parse this but I'm not really sure. > > All I know is: > > unsigned int size = ibuf[2]; > > and that is really a 4-byte unsigned quantity so anything less is an > arbitrary limitation. There is no limit on CPU equivalence table length in this patch series like it was in the previous version. The maximum possible value returned by install_equiv_cpu_table() of UINT_MAX + CONTAINER_HDR_SZ comes from the maximum value of this 'size' variable (that is UINT_MAX) plus the header length of CONTAINER_HDR_SZ. This won't fit in 'int' type, hence this patch. That's because this functions tells its caller how much bytes to skip from the beginning of a microcode container file to the first patch section contained in it. Maciej