Received: by 2002:a05:6a10:87d6:0:0:0:0 with SMTP id g22csp847951pxr; Mon, 11 Apr 2022 08:38:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztpL/FRGcLtpFxD6EDT1X351kHtuh0I+1Pi64vVxMSgWONlbDWf+TAgfAbOjZAvkrvRAbY X-Received: by 2002:a63:d34c:0:b0:381:b709:4e21 with SMTP id u12-20020a63d34c000000b00381b7094e21mr26616775pgi.267.1649691525559; Mon, 11 Apr 2022 08:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649691525; cv=none; d=google.com; s=arc-20160816; b=GHricSChz9/lN3fg7uo2Zzzy2s3gm2RNdtx5jgTbr/lNU/YhfGaQ4mXQ62kXEf1vKg lwcr78Molanzzu2dge78/31i8NwbFSqXmVVBX30DdI+q4dJkNkHY0YxcDrFxlIDE1zNY OY6iK/7GU3XtcR+f/9J3+7rVYy37ZNloBNAW2PLHwHSwEu6cq5jNWkPKP7y0OBhBTvkg GOpenvr9XP2vMdSX9bfghpWAcDtkbrvw/TPdXgqVMSNwLqneesRQmyubOoxG8/k2XCj7 72nshsLSapZGq8XF9KmLBYSejgKy+TCo2WLR+lFC6U8JJOm7K4QjQIcnxXp2roISW+Wd nyCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=UumSOi3bVb4/q3h+ATEP8uiyPH1qa/l+xbjDc3aGRoY=; b=r8clH4QPhb5wpRH6rQkLhcauJMO+dv7SRFH22mI5ZBH4gAu6cQsk12dh0jA0PHAHIv k7o2LH9yE9GefvvBTIMRBFfz5e56ocs7iu03kOVyaComo9gvLY5LVKYjY2Kwi2v8U81s 9O26tPk4PV0LhaePtdt95X8Q5CWAR61n9R0HWWgnz8ua3e2i7qcPT+2SQozBhDh7Pk/m 1xpPYGZUsE1Rikw8iTOY2DEdJF1a/+IT1mAGK0Za9Y6bU+5LX/Kl9bY7WkM5zB7kfPKB KKpQuKbtTVrKfU9TQt7flvAM5OrFG09iDmqyA18srmd/lxs9XQDQFSHGDDCIw1Mf+T+O Nn7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Wpfv8e/Q"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a170902bf4600b00153b2d16646si8503177pls.590.2022.04.11.08.38.30; Mon, 11 Apr 2022 08:38:45 -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=@gmail.com header.s=20210112 header.b="Wpfv8e/Q"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233343AbiDJAxx (ORCPT + 99 others); Sat, 9 Apr 2022 20:53:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233329AbiDJAxv (ORCPT ); Sat, 9 Apr 2022 20:53:51 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DC00105 for ; Sat, 9 Apr 2022 17:51:42 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id bh17so24144460ejb.8 for ; Sat, 09 Apr 2022 17:51:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=UumSOi3bVb4/q3h+ATEP8uiyPH1qa/l+xbjDc3aGRoY=; b=Wpfv8e/QtYVqq+ae3AXvVreoZ7ZF1txzYHecTrr6f56GfjQtarUN44NuJsrNRyb/pn yXdgDWBp+gdex/zmzOXSU+AORuclxUPOTszcK7G6DjWiDLLFThwtIzCB13ekoVvA0jTi F12b9sY+ZsI6QCdTC+pzifJnBCrldSU7l2fy/Cx2hsspibI6TSkqO0aJBsqW9KuRz40g QIc3LcQacL/TRM1to+DMqQl6wL6CCJNdp/f7PsLM+3gkznrfWcd5WsQptG2mtUyUK27a mRx7WK5dYQao28oCwkjSvy7fXVbvaeRGgOlW/V/GBKfTWIdtlRbhA1Kjd06Jxrhgr0iR ltKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=UumSOi3bVb4/q3h+ATEP8uiyPH1qa/l+xbjDc3aGRoY=; b=RTNLqis63O4QJs+LrOaUW+xD0Nt2SJZUmAMxmZyXw6tyJ51pl0uk8p1SYga5GJ3JLv Ujp8zBlyNQtqIRqlbuxh7adsFwNwYEETJd6kQxjkDkc83RyMWlKWpjjlPzfUgSTGc4zv WgmuBN7pfFlOHGA8KAq+JGuUZbUNG9Y61sviCSQwdUq84Q2pHIHrWDleD+mCkv22nsSA awg/G0X1GU8IC4xQ7oJ3DocR10PUyqN24XWCLbxozXT8uM1WAyls1OWXYIkKm+ub2EXz LPq/6IPn8IaNtSUKMpAvcYtC68CY478eTXKCVvD47dlx1piIdAWxA16haiqvV0+ie7oy 2MYg== X-Gm-Message-State: AOAM532JB8+ZwA5TuVSl1A987laintDSfQZtmPP3cHB6v+8Byty2/pd6 lrMaNjfmQjP7KOZ+kC6ZbGWSCJmq+XeGv8WYv4o= X-Received: by 2002:a17:907:daa:b0:6e4:9b0d:3f1 with SMTP id go42-20020a1709070daa00b006e49b0d03f1mr23879729ejc.37.1649551900752; Sat, 09 Apr 2022 17:51:40 -0700 (PDT) MIME-Version: 1.0 References: <20220408092803.3188-1-h0tc0d3@gmail.com> <4o2YD5id7zhK5g__CUK3Yf-6Dj459XQ0qsydW6wKHdco3YYtl78BqGUfXvQ9UO0AZoAsMPfhFB0jw1BFldiFDcbZXmGgsobuAoTMWmoDqmE=@emersion.fr> <436116c9-6ce4-87cc-b1cd-f44b72fcfb35@amd.com> In-Reply-To: <436116c9-6ce4-87cc-b1cd-f44b72fcfb35@amd.com> From: Grigory Vasilyev Date: Sun, 10 Apr 2022 03:51:39 +0300 Message-ID: Subject: Re: [PATCH] drm/amdgpu: Fix NULL pointer dereference To: =?UTF-8?Q?Christian_K=C3=B6nig?= Cc: Simon Ser , Bas Nieuwenhuizen , Rodrigo Siqueira , Melissa Wen , Alex Deucher , "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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Christian K=C3=B6nig, Simon Ser In fact, the code looks strange, we return the return code, but for some reason we also write false and 0. In my opinion, the caller should do this. Of course, you are right, but I look from the position that nothing should fall in the user system. There may be strange errors that occur periodically under certain conditions and do not affect developers. Also, the user will not always be able to correctly write a bug report. Regards, Grigory. =D0=BF=D1=82, 8 =D0=B0=D0=BF=D1=80. 2022 =D0=B3. =D0=B2 17:30, Christian K= =C3=B6nig : > > Am 08.04.22 um 15:21 schrieb Grigory Vasilyev: > > 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. > > Which is perfectly fine. > > See error handling is to handle userspace or hardware errors and *not* > coding errors. > > Testing all pointers for NULL without any reason is not defensive, but > rather the exactly opposite since it helps hiding real bugs. > > Regards, > Christian. > > > > > =D0=BF=D1=82, 8 =D0=B0=D0=BF=D1=80. 2022 =D0=B3. =D0=B2 14:48, Simon Se= r : > >> On Friday, April 8th, 2022 at 13:28, Bas Nieuwenhuizen wrote: > >> > >>> On Fri, Apr 8, 2022 at 12:01 PM Simon Ser contact@emersion.fr wrote: > >>> > >>>> Is amdgpu_display_get_fb_info ever called with NULL tiling_flags/tmz= _surface? > >>>> If not, there's no point in adding NULL checks. > >>> It isn't called with NULL anywhere, the NULL checks that already exis= t > >>> seem redundant. > >> Grigory, would be be willing to submit a v2 which removes the unnecess= ary > >> NULL checks? >