Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp528235pxw; Fri, 8 Apr 2022 13:55:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrweSVSRYC/8l/o5ypqRcrXrnERMfkNFL9nZUWJ6QUO+sMmoAXU3Mnr64CakWE2y9EbJHD X-Received: by 2002:a05:6402:c9b:b0:41c:c215:2cce with SMTP id cm27-20020a0564020c9b00b0041cc2152ccemr21518333edb.388.1649451316425; Fri, 08 Apr 2022 13:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649451316; cv=none; d=google.com; s=arc-20160816; b=sPkK9oZwj2vNe2ApmWdk5Qd0EWNo8nPmgwtUapMY7094HjB6d1O89n/K0eTNJAguvd f39Hz7YOzHRvQU8A6oKVyJ2DbzQetSGc9DGs8EMDNEEIvWzLQvOU/eTs/Ecf0MYO2ee3 UrM9VyLNyuomOCs/X6av9vX/PfpgpZtJdc1VkSWhIL/Aq32Qz6DFm2FQ3d5TAxDTv9ic 05nQiL58QCYZPkH4uwyl6aEjMSc+9skf98/0wGInAylYg3XwLiAfBfoAuZ7EJiD4xoSd NCJZ3o8eu24HdGozus3U4mluGyAVGHG1qNtU6ECrG36L+eVeryEidR3fMz03kJi81q7j tOnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=xKdnbX/uu4zDxFZ8hCkBVd/wtWNCWZBH1JAcwPtLw/U=; b=PddMWUa9gvbKK0oeaMv9ToU+xRaHgHc1Rc8hF87Zt4CV7Tlad4HavNTMrjKvgIpMxM u94s8wOoxbN+LCB2GouUdkZ1oz0yaR5QTUmsawNu8p6tmNPQ3B6pYsvUb3mgcVbn62OK HwND6q5hpLjucGNL9pq03ArbknqyhLBTFFcKNRH/FHlfX1oiXvqpFh4L46pAGswthDdC +rFztfRZNF5Mj26pHaoSNwQ3FrOUAgDvT3TSmEEJNVYIQSbXI+cG6FdQ3wj/FsBMBXwz 4rWb7OD3schRx3W37GYCaZZhjFN9yEXaTg937ZaHCX0Tt/g7hqsJH1VlfGuaFPUUay0P kW6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@emersion.fr header.s=protonmail2 header.b=LIdIuHNo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=emersion.fr Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o4-20020a1709061b0400b006e8547516d5si1604314ejg.736.2022.04.08.13.54.50; Fri, 08 Apr 2022 13:55:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@emersion.fr header.s=protonmail2 header.b=LIdIuHNo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=emersion.fr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236258AbiDHN3J (ORCPT + 99 others); Fri, 8 Apr 2022 09:29:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234901AbiDHN3G (ORCPT ); Fri, 8 Apr 2022 09:29:06 -0400 Received: from mail-4323.proton.ch (mail-4323.proton.ch [185.70.43.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 056A1116B50 for ; Fri, 8 Apr 2022 06:26:58 -0700 (PDT) Date: Fri, 08 Apr 2022 13:26:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail2; t=1649424416; bh=xKdnbX/uu4zDxFZ8hCkBVd/wtWNCWZBH1JAcwPtLw/U=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID; b=LIdIuHNo44bjyNxrW+WjYFfH/4NTVydxbOGEB5iHHJ3owDhI4nYaiOvipxfn+FXvy ISRv3yZxCJWe8nQIA+ES9ZFYs7Jhe+sXhp3X8qfjIK1tltflAvTcAUkIyz2okxJiOn Zx6dmDOJ6pBaKfMrw1tK0kMiaQ4KAsz3eAPmgzBLiWEWnj+5Ym6Xg+FUNd8bTi3jHZ VWAJdM/yRINXPQFHaVfE438ETtnh/XPI90OfXoTxM91zwnBG69RVqDCRevgTx8iRNS IOjnq3OqvlRm0L5NAM6LToaXr+Nq6HbePYTbRzixIBO9e1CiSKJSr5s4urJpVoLlp+ vI7nkcslF/stQ== To: Grigory Vasilyev From: Simon Ser Cc: Bas Nieuwenhuizen , Rodrigo Siqueira , Melissa Wen , Alex Deucher , =?utf-8?Q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , =?utf-8?Q?Michel_D=C3=A4nzer?= , Evan Quan , Sean Paul , Qingqing Zhuo , amd-gfx mailing list , ML dri-devel , LKML Reply-To: Simon Ser Subject: Re: [PATCH] drm/amdgpu: Fix NULL pointer dereference Message-ID: <2GaGJp5T0FARGpEE4FSEdCCQQNOecHtBBdQxqneeCWad2PD7gKqhp6-2LhdZSpTvDToW2kKggbfzlcvw9vsM7L_kJXo1uMNjoiAHJ4bQAjI=@emersion.fr> In-Reply-To: References: <20220408092803.3188-1-h0tc0d3@gmail.com> <4o2YD5id7zhK5g__CUK3Yf-6Dj459XQ0qsydW6wKHdco3YYtl78BqGUfXvQ9UO0AZoAsMPfhFB0jw1BFldiFDcbZXmGgsobuAoTMWmoDqmE=@emersion.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday, April 8th, 2022 at 15:21, Grigory Vasilyev w= rote: > Simon Ser and Bas Nieuwenhuizen, do you understand that you are > proposing to make the code less safe in the future? In the future, > someone might rewrite the code and we'll get an error. I don't think we should blindly add NULL checks for all functions which take a pointer as argument. This makes it way more complicated to find a bug when the function is mis-used. Crashing is better because it indicates a programmer error. In the future, any new call with a NULL pointer will produce a clear error. Using pointers for output values is a common pattern in C, it allows a function to return multiple values.