Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp117346ybm; Thu, 28 May 2020 17:45:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzF2Q708ikhpw2vEwauGEXpXx+dVKb5iXcCQP2U8m3oNgt4DnAtKNIOnlLX3LiRXGnidikT X-Received: by 2002:a17:907:11cb:: with SMTP id va11mr5738227ejb.515.1590713107629; Thu, 28 May 2020 17:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590713107; cv=none; d=google.com; s=arc-20160816; b=RRqAV7Dnd3Mqa4ojEBQGqfwAMj3eRH6E4HqDIn7pJ9O1NEEBmpKG/DuTdIt/WN8uYK J3KYddBelmPgIfgO/g1coItgJSVypD+62shy70t0kyh1YbBXpK5yOfxiaBKOxu3EQynf iAgqxYES5ADFizdNj6g3aq/o2XqZ+qvaHO1n605oZl4mXffKdfTBLoxustf9hF6VxD1o 81ldqOqhxKUCcYAj7eS7gNULr9xAQCu8l4XEaULRZnhHKNf+45UN5a41RBUekQkbQrh4 knwJb3ba08YaSX5L7y8LyaKtjT8qbuHIMrpVuIqPzC91jC3sWg1oaa9LLCBaQWmZxYEP 4Ffg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=eUZ6XnHB3SytlpzEEiC0z3n6W6/+b6Ej7vH8IV/KtBs=; b=GeuHttmMNIAc+MTQYrgCD3O2umueBzYlQPFRKg2XRtS2yk2NgnY+j1wpCK7RkWNsYf 10I4oRITH2PMz2Qsvpr9TMe8dTMMicrcmtUAiEOXwqeMx60RIDHnNb3gNP3k+KsZIVU/ xAUFEIdqiwmAr79p8ncTZ58I9urwBjgY7kMxBaDLxR/YXOu7RQdgzUX1ECRwWsv083vQ DPrnTpOOEEi5vtZdXEa/XluOzQogdEhIYjkBwPDd6FbEoQuZLSXylWae9znNehGdOlge xOWTuauqeDTY48Ip/9nqQyVf7jiy7b9JulNbtnw3lBFblHtMY+nkEgKgMa4HimEzuRAX vEzw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ar16si5822342ejc.521.2020.05.28.17.44.43; Thu, 28 May 2020 17:45:07 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438168AbgE2Alt (ORCPT + 99 others); Thu, 28 May 2020 20:41:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438133AbgE2Als (ORCPT ); Thu, 28 May 2020 20:41:48 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 888F9C08C5C6; Thu, 28 May 2020 17:41:47 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.93 #3 (Red Hat Linux)) id 1jeT5l-00HFg9-RG; Fri, 29 May 2020 00:41:46 +0000 From: Al Viro To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jani Nikula Subject: [PATCH 1/5] i915: switch query_{topology,engine}_info() to copy_to_user() Date: Fri, 29 May 2020 01:41:41 +0100 Message-Id: <20200529004145.4111807-1-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200528234025.GT23230@ZenIV.linux.org.uk> References: <20200528234025.GT23230@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Signed-off-by: Al Viro --- drivers/gpu/drm/i915/i915_query.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_query.c b/drivers/gpu/drm/i915/i915_query.c index ef25ce6e395e..ad8e55fe1e59 100644 --- a/drivers/gpu/drm/i915/i915_query.c +++ b/drivers/gpu/drm/i915/i915_query.c @@ -25,10 +25,6 @@ static int copy_query_item(void *query_hdr, size_t query_sz, query_sz)) return -EFAULT; - if (!access_ok(u64_to_user_ptr(query_item->data_ptr), - total_length)) - return -EFAULT; - return 0; } @@ -72,20 +68,20 @@ static int query_topology_info(struct drm_i915_private *dev_priv, topo.eu_offset = slice_length + subslice_length; topo.eu_stride = sseu->eu_stride; - if (__copy_to_user(u64_to_user_ptr(query_item->data_ptr), + if (copy_to_user(u64_to_user_ptr(query_item->data_ptr), &topo, sizeof(topo))) return -EFAULT; - if (__copy_to_user(u64_to_user_ptr(query_item->data_ptr + sizeof(topo)), + if (copy_to_user(u64_to_user_ptr(query_item->data_ptr + sizeof(topo)), &sseu->slice_mask, slice_length)) return -EFAULT; - if (__copy_to_user(u64_to_user_ptr(query_item->data_ptr + + if (copy_to_user(u64_to_user_ptr(query_item->data_ptr + sizeof(topo) + slice_length), sseu->subslice_mask, subslice_length)) return -EFAULT; - if (__copy_to_user(u64_to_user_ptr(query_item->data_ptr + + if (copy_to_user(u64_to_user_ptr(query_item->data_ptr + sizeof(topo) + slice_length + subslice_length), sseu->eu_mask, eu_length)) @@ -131,14 +127,14 @@ query_engine_info(struct drm_i915_private *i915, info.engine.engine_instance = engine->uabi_instance; info.capabilities = engine->uabi_capabilities; - if (__copy_to_user(info_ptr, &info, sizeof(info))) + if (copy_to_user(info_ptr, &info, sizeof(info))) return -EFAULT; query.num_engines++; info_ptr++; } - if (__copy_to_user(query_ptr, &query, sizeof(query))) + if (copy_to_user(query_ptr, &query, sizeof(query))) return -EFAULT; return len; -- 2.11.0