Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4952256rdh; Wed, 29 Nov 2023 16:09:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGaxOfVE3w1wlstFABMiQPMy2+8D1n9L8VUhU/AFYIoe8mEbHEThF7+tKSV1XtyGgYANCAz X-Received: by 2002:a05:6a20:7d8f:b0:18c:8ff1:f0b with SMTP id v15-20020a056a207d8f00b0018c8ff10f0bmr13396934pzj.56.1701302957154; Wed, 29 Nov 2023 16:09:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701302957; cv=none; d=google.com; s=arc-20160816; b=k0NIdAlKiw1/Uol1WbbUQ4QBegdzVJcfm6qCeW8zfu5OFKLzmFE3GVmObQ9iRrFVoP LUzFhM4aJSX/7cmumUs0yTgnYUGBN3tuzm1DFTvBhOraHaPu21yytOYeEr0jTg1PWSWG U+qP7UXqq+XHP1Vgh5g7p5CeAtV8Hrg2imFiKIt5ibByIUgXpoUfKyoZteT4p6whstOL XmsuT9qPgIHbbvLLTgF9HQ2NNOFA/5uU4gmAkySX6mXi7w0Lx2gmH8+XQyZg/tieJOUb 4dALBoD5Vj+dSbiEb/vIV7fhKskvU54iVy0L1Pb6Fy1nxWkJAoG8yZSA7uGjdJgG0Ido a5Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=dCyXRa/HRcuMhxSELQ2U4bOOtsV2/Jacvl5LozlvP7c=; fh=yYD5qdS8jpI/Q0IyRRhSqm/zt55R1ngrB9vOKHgYeNM=; b=ZaBtoBMtpYBXj7GlSrVfc8UYGoOgeTU0SBYh2R5FAnQQ5Yi82eZzFi4QNwv+69wfcV /n5Vr8md28AmpQfdEAhyfaBH6QY5gXb84WLdE49L873TRL4nxNyWKdVz3PlwAf/tSE9y pL5gjXrCZHoC1Yll9DPBDnfCtmyrWrXjfIsfQA6ldBK4UX0fx47nVxJi4WOvIJxxoknc Lp+HmaJWSBDivvm/mwfCL+is6vv9ZxEhWshDAeJFgma/GJ9bk9HDSuVxZHDCfySENZs5 fEHpxsaw10DU1G3D/STg41l2YlJMMDNS/en74QRsCdrUj0vFiPtVHxxOKi6/D3nG10cQ qa7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hWBPTYYz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id z4-20020a63e104000000b005c5e26ed226si3056pgh.429.2023.11.29.16.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 16:09:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hWBPTYYz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 6B68880BB1FC; Wed, 29 Nov 2023 16:09:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343723AbjK3AI6 (ORCPT + 99 others); Wed, 29 Nov 2023 19:08:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231635AbjK3AI5 (ORCPT ); Wed, 29 Nov 2023 19:08:57 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDD5F10C9 for ; Wed, 29 Nov 2023 16:09:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701302942; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dCyXRa/HRcuMhxSELQ2U4bOOtsV2/Jacvl5LozlvP7c=; b=hWBPTYYztYJyXFmv0B/6XcRVmRkwJlpon/d/OIxtamqlm3Sw9vqKWf2N/Fe8k9trMgsXrm NrmjTIzEkC7kYqGYywBmvVbgEejayV/51iGAm2gSm/+Wjhss5lEB2zCWB4iNeKBE4A+Xnb hlaEK/FNkKgnLGApye/14cno5xYpQ24= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-384-Lun819n0Mz-kP4vWHreRTA-1; Wed, 29 Nov 2023 19:09:00 -0500 X-MC-Unique: Lun819n0Mz-kP4vWHreRTA-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a00dd93a5fcso33309766b.3 for ; Wed, 29 Nov 2023 16:09:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701302939; x=1701907739; h=content-transfer-encoding:in-reply-to:organization: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=dCyXRa/HRcuMhxSELQ2U4bOOtsV2/Jacvl5LozlvP7c=; b=uQdNsTXUcO3jxlUVCpvKMCS8xG2yYZnqru21+DFScWvR446/MoUGLLIMuLecaPlq9o y9iFN4FlpQGtZgNKklnzRqeqyLxdk+V/AkwKR/Ned3zN4YHxkWNApT2dr0QadCvwaOEl x6VDul9vTlFlEro+sv3CylsX0aRcFbUInb9ceZ6CwOed1jjsjOtQH4B0AhLSi3inG8F6 2DBFtUJF2PQ+1/fQSfI3u3nVC+WKq1uRwseJHy/cg2rXJyArhrlGz0knDc9P00TijH+O wFEHnw7UmmGTd5UJIqibezCXgcG3W8ZyR4KclzgLog2HMoZIffu08idzxy8gsdGHc+7z XrDg== X-Gm-Message-State: AOJu0YwWYbpr5qAEBdYLxu6eIXReXBRh3YFYSxo32MOHOSSvix1Zuz2V /EBzaeshVNzVQAs3j8OTJAuh0C/gFfekF9Q93yit/XJxSgr5pvpIWwES1lYNgCf2nPBabypQar5 YMzgfRzenvZOKXL1Rh+63Jfr9WN1OYBHk X-Received: by 2002:a17:906:a8d:b0:9fe:1681:22c7 with SMTP id y13-20020a1709060a8d00b009fe168122c7mr13130035ejf.26.1701302939155; Wed, 29 Nov 2023 16:08:59 -0800 (PST) X-Received: by 2002:a17:906:a8d:b0:9fe:1681:22c7 with SMTP id y13-20020a1709060a8d00b009fe168122c7mr13130025ejf.26.1701302938899; Wed, 29 Nov 2023 16:08:58 -0800 (PST) Received: from ?IPV6:2a02:810d:4b3f:de9c:abf:b8ff:feee:998b? ([2a02:810d:4b3f:de9c:abf:b8ff:feee:998b]) by smtp.gmail.com with ESMTPSA id ay19-20020a170906d29300b00a0c3b122a1esm26634ejb.63.2023.11.29.16.08.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Nov 2023 16:08:58 -0800 (PST) Message-ID: Date: Thu, 30 Nov 2023 01:08:57 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/nouveau: Removes unnecessary args check in nouveau_uvmm_sm_prepare Content-Language: en-US To: Yuran Pereira Cc: kherbst@redhat.com, lyude@redhat.com, airlied@gmail.com, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, nouveau@lists.freedesktop.org References: From: Danilo Krummrich Organization: RedHat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 29 Nov 2023 16:09:14 -0800 (PST) On 11/16/23 21:52, Yuran Pereira wrote: > Checking `args` after calling `op_map_prepare` is unnecessary since > if `op_map_prepare` was to be called with NULL args, it would lead > to a NULL pointer dereference, thus never hitting that check. > > Hence this check can be removed, and a note added to remind users of > this function to ensure that args != NULL when calling this function > for a map operation as it was suggested by Danilo [1] > > [1] https://lore.kernel.org/lkml/6a1ebcef-bade-45a0-9bd9-c05f0226eb88@redhat.com > > Suggested-by: Danilo Krummrich > Signed-off-by: Yuran Pereira Applied to drm-misc-next. > --- > drivers/gpu/drm/nouveau/nouveau_uvmm.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.c b/drivers/gpu/drm/nouveau/nouveau_uvmm.c > index 5cf892c50f43..c8c3f1b1b604 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c > +++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c > @@ -604,6 +604,10 @@ op_unmap_prepare(struct drm_gpuva_op_unmap *u) > drm_gpuva_unmap(u); > } > > +/* > + * Note: @args should not be NULL when calling for > + * a map operation. > + */ > static int > nouveau_uvmm_sm_prepare(struct nouveau_uvmm *uvmm, > struct nouveau_uvma_prealloc *new, > @@ -624,7 +628,7 @@ nouveau_uvmm_sm_prepare(struct nouveau_uvmm *uvmm, > if (ret) > goto unwind; > > - if (args && vmm_get_range) { > + if (vmm_get_range) { > ret = nouveau_uvmm_vmm_get(uvmm, vmm_get_start, > vmm_get_range); > if (ret) {