Received: by 10.213.65.68 with SMTP id h4csp819138imn; Thu, 22 Mar 2018 09:13:19 -0700 (PDT) X-Google-Smtp-Source: AG47ELvWTPy/qY6OmRL4bRJC6WiNFugzuJE33FK9eLFb1l3eXEfXK6CV/r45XpwcMKwyK7WMLExc X-Received: by 10.99.143.75 with SMTP id r11mr3634476pgn.341.1521735199537; Thu, 22 Mar 2018 09:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521735199; cv=none; d=google.com; s=arc-20160816; b=dIGKL230Z3Q+uW8Vz88nJEHCxOEwyQFxiiqZP/d0s4nF0VghTXWZebPTP0NaZeAsgm iMD8P31lU81miV97AWTUF/CVnApCQ8Hym7byfn5lmiMp6ehTRc1jkPeoCUdqmuDqpQ+8 s4HTyRgmJN79dX1m77vGxjeAz2FKEBAqPFtYV4gBvrdNfjSZw5rAgo8gnFDdZEOnKrE5 Bf9Y+6mRf6fJkFXhHw8HX8G27aES48ApHl8XyZNL7pAx4PCgYaUP/dDJMaMHaa0ZFHxN O7Den5ocTNipkGoO4wETzD09KZKi4rEH5NKm5rKRi50ndTCsSRnkab6T3q8mHUV4rebi k6nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=A3DQmiu5zmroGom0JK6PJ/za7/YHLQ2Kmlv5vMvNe/g=; b=rfyTcqmgwzuM+3u8tBLQAeCRkGImIT4Ibrdd8Urj7Iz7mumG4B4EvrXN1d+Nzowd+T iV39171iZ0SlFV4IlpLyO6tLJW/fCOWSLyMNxvhvDFIpPXyrsgJN+9AbDsUSbSKFAaS8 9zl3gKNbGCx8OJwNePl3WYWEWK7dqfUKOq8MxDrjQ0uEvQBFuqaqMgL9T6XV/r7CbuoS 3tu9TtvN4c8snMLbCSvJqibhnDzWh0X5QKojfDKfLHnVl1EmlbcSDsgvvnxaZJ2K3sA1 oTeeWJmVofJcAEC23G3h39Q68ZqkU6k1p098BC2+7wb7L3VtCw2Aguchddl1JmbqsZdh S6vQ== 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 l69si5167962pfb.389.2018.03.22.09.13.04; Thu, 22 Mar 2018 09:13:19 -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 S1751798AbeCVQMD (ORCPT + 99 others); Thu, 22 Mar 2018 12:12:03 -0400 Received: from mail.skyhub.de ([5.9.137.197]:39786 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751531AbeCVQMC (ORCPT ); Thu, 22 Mar 2018 12:12:02 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id KGmHtC4nsfiN; Thu, 22 Mar 2018 17:11:44 +0100 (CET) Received: from pd.tnic (unknown [IPv6:2607:fb90:46bc:805b:1a5e:fff:feef:3f49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 125761EC0281; Thu, 22 Mar 2018 17:11:42 +0100 (CET) Date: Thu, 22 Mar 2018 17:11:30 +0100 From: Borislav Petkov To: "Maciej S. Szmigiero" Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 06/10] x86/microcode/AMD: Check patch size in verify_and_add_patch() Message-ID: <20180322161130.GA11575@cz.tnic> References: <30562911-7fde-782b-d1b2-03e30b6987c5@maciej.szmigiero.name> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <30562911-7fde-782b-d1b2-03e30b6987c5@maciej.szmigiero.name> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 16, 2018 at 12:08:17AM +0100, Maciej S. Szmigiero wrote: > @@ -505,7 +505,7 @@ static unsigned int verify_patch_size(u8 family, u32 patch_size, > break; > } > > - if (patch_size > min_t(u32, size, max_size)) { > + if (patch_size > min_t(size_t, size, max_size)) { So I don't like this conversion to 8-byte-width size_t's. It is not necessary. I'm pretty sure we can do fine with signed and unsigned ints. For example, you can convert the size to signed int (if it hasn't been converted yet) and check for < 0 and stop further processing. And so on... Thx. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. Srsly.