From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2A8AC04A6B for ; Fri, 10 May 2019 11:16:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 848E020989 for ; Fri, 10 May 2019 11:16:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Abzn+43J" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727435AbfEJLQo (ORCPT ); Fri, 10 May 2019 07:16:44 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:50378 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727210AbfEJLQo (ORCPT ); Fri, 10 May 2019 07:16:44 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4ABDrMj173329; Fri, 10 May 2019 11:16:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=pugw6u1DF8kTo0TWxMB5HqnwhA3PgsdFoHz299/SPlk=; b=Abzn+43JBICvtCRhuBAc1+7aLsd0eu2y45um2Qpgp5bmifpmkUigT+VkE0zItNmAAKcP EPPn9+PcjPFl4Yhcs8ufQKpHM/cQ3pjA014xZzC4xy8ibuOGb/saqubvtcsEWG7MQcD5 fHPiJq6t/0bu4r1gJkt/mYy2AVh9ya7HU4X0Dr8AYaelLivfGTOhEwgZznAw4Eyky00X qnwI9AtRbn04ZZzs9x288o8gT6+weVjrPI5zaijD61ySNeeWIoEM8xSetRWIDD9P+yCm dvLooM+zKzCvwtizvKij9p5hYh3VUd5Snw7gEl7JS6q5xpc4eMBXJWSdYAkDdKlO+2So AA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2s94b18btq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 10 May 2019 11:16:37 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4ABG0im010795; Fri, 10 May 2019 11:16:36 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 2sagyvsc8h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 10 May 2019 11:16:36 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x4ABGVnM023759; Fri, 10 May 2019 11:16:31 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 10 May 2019 04:16:31 -0700 Date: Fri, 10 May 2019 14:16:23 +0300 From: Dan Carpenter To: Colin King Cc: Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , David Zhou , David Airlie , Daniel Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] drm/amdgpu: fix return of an uninitialized value in variable ret Message-ID: <20190510111623.GC18105@kadam> References: <20190510100842.30458-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190510100842.30458-1-colin.king@canonical.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9252 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905100080 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9252 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905100080 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 10, 2019 at 11:08:42AM +0100, Colin King wrote: > From: Colin Ian King > > In the case where is_enable is false and lo_base_addr is non-zero the > variable ret has not been initialized and is being checked for non-zero > and potentially garbage is being returned. Fix this by not returning > ret but instead returning -EINVAL on the zero lo_base_addr case. > > Addresses-Coverity: ("Uninitialized scalar variable") > Fixes: a6ac0b44bab9 ("drm/amdgpu: add df perfmon regs and funcs for xgmi") > Signed-off-by: Colin Ian King > --- > drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/df_v3_6.c b/drivers/gpu/drm/amd/amdgpu/df_v3_6.c > index a5c3558869fb..8c09bf994acd 100644 > --- a/drivers/gpu/drm/amd/amdgpu/df_v3_6.c > +++ b/drivers/gpu/drm/amd/amdgpu/df_v3_6.c > @@ -398,10 +398,7 @@ static int df_v3_6_start_xgmi_link_cntr(struct amdgpu_device *adev, > NULL); > > if (lo_base_addr == 0) > - ret = -EINVAL; > - > - if (ret) > - return ret; > + return -EINVAL; >From a naive reading of the code without knowing the hardware spec then you would probably think that lo_base_addr can also be uninitialized. regards, dan carpenter