Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp634713pxu; Thu, 3 Dec 2020 08:57:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPKkuDIbDYP3BVmUKh5s64PdF/hnJJOdvja+/+KiGL4dDMlYJTm6hD0ysBiNuPGUI9N2wi X-Received: by 2002:a17:906:e086:: with SMTP id gh6mr3229369ejb.95.1607014663091; Thu, 03 Dec 2020 08:57:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607014663; cv=none; d=google.com; s=arc-20160816; b=j+BORA82NRfdb4PTYKrlinYJOgdAfniDRs/gfix98DV1Vh/nwVfNGXOP56TZJ7GDqV 2eB24/fazkDWQN54vFKgJ/zB/WIpvN7M6pj0kgdgE3scFlJlhUxeatJUfnYKCnSSUB5f 3yoLYI9RBhsJbzGOU2M3FSRv9hc7NyiZhVovv7TKD1peXuAjWqXGLYduYD3Wn6DMjhj/ rDd7kjO/R95dYhSKk2o16Sj2MUDzIxFeTGJEk40iWZaLqmPvmOg+1l8e5nYgGBpc41vg lc7mb8Bs/fyt6ANyaNJpFU9tCH+GfEVRJc5Mqs06qplslW1gel/70r4iiw7LjRsQvSGa BVXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1k/t6b4LXMSVxlAgVlHShY06OjLTQn6wiKPCdflr+MQ=; b=YJt3MtwIOyyDnHsbmmNe3rARAL/B7f+H4eOxpCxWHvHnfEd804GrijhpXEPI9wbNog eFr72JuOeDbf/VmNzoI3M78tWIxl50TJfNPFzjZADQga7fps76vgMLbPwUKL5dOeunhE 9/AmLge/pJmVlTBcimBTDNnnrcEJqb+EbWGRfT2vae1fryReKTQrzLgyq3BTopn0LI66 GodY3FEt8vmj7RAdm6UWAMCwgjt9CddnwmD/MBR8VVzYskOYguzxOUL1Uw9azDf+5fK2 QtiLQYktNal4OMGohzjHmH47HGO+MgD1ZJzwe4jgcXi3cMOtIiC8MBYyL+5Gv23fgD85 YOlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=HBTbaTIx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k16si1220848edr.236.2020.12.03.08.57.17; Thu, 03 Dec 2020 08:57:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=HBTbaTIx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728922AbgLCQzI (ORCPT + 99 others); Thu, 3 Dec 2020 11:55:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726137AbgLCQzI (ORCPT ); Thu, 3 Dec 2020 11:55:08 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCB8FC061A4E for ; Thu, 3 Dec 2020 08:54:27 -0800 (PST) Received: from zn.tnic (p200300ec2f0dc5004496c992b512bfd2.dip0.t-ipconnect.de [IPv6:2003:ec:2f0d:c500:4496:c992:b512:bfd2]) (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 3D3451EC0434; Thu, 3 Dec 2020 17:54:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1607014465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=1k/t6b4LXMSVxlAgVlHShY06OjLTQn6wiKPCdflr+MQ=; b=HBTbaTIxYsabbk+5cJQ6J8bVeIQnRAZol1g0hxZLSIoZ36uq/z5yjXDHNZOGK8hysyvnDH 5k+oqqPQsi+Z3d4A2GgOfS2fA9eUAsvfbvqn+uE7i6OR2UKlq/9CHlzzE2YYFBnsr/0Nzj 2i4sWgX23kmAgimSEJiISYGC29Xx1eg= Date: Thu, 3 Dec 2020 17:54:20 +0100 From: Borislav Petkov To: Tom Lendacky Cc: Masami Hiramatsu , x86@kernel.org, Thomas Gleixner , Ingo Molnar , Kees Cook , "H . Peter Anvin" , Joerg Roedel , "Gustavo A . R . Silva" , Jann Horn , Srikar Dronamraju , Ricardo Neri , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/3] x86/uprobes: Fix not using prefixes.nbytes for loop over prefixes.bytes Message-ID: <20201203165420.GL3059@zn.tnic> References: <160697102582.3146288.10127018634865687932.stgit@devnote2> <160697103739.3146288.7437620795200799020.stgit@devnote2> <20201203123757.GH3059@zn.tnic> <20201203124121.GI3059@zn.tnic> <20201203124820.GJ3059@zn.tnic> <1c1b265f-34e3-f5cc-0e7b-186dc26c94b7@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1c1b265f-34e3-f5cc-0e7b-186dc26c94b7@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 03, 2020 at 10:45:48AM -0600, Tom Lendacky wrote: > Since this is based on the array size, can > > idx < NUM_LEGACY_PREFIXES > > be replaced with: > > idx < ARRAY_SIZE(insn->prefixes.bytes) Actually, this needs another change: struct insn_field { union { insn_value_t value; insn_byte_t bytes[NUM_LEGACY_PREFIXES]; because you can have max. 4 legacy prefixes and then we can do either of the checks above. Mine is shorter tho. :-) -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette