From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============4815923529888726660==" MIME-Version: 1.0 From: Jason Gunthorpe To: kbuild-all@lists.01.org Subject: Re: [rdma-rdma:wip/jgg-for-next 198/203] drivers/infiniband/ulp/rtrs/rtrs-srv.c:1805 rtrs_rdma_connect() warn: passing zero to 'PTR_ERR' Date: Tue, 16 Feb 2021 14:58:15 -0400 Message-ID: <20210216185815.GF4247@nvidia.com> In-Reply-To: <20210215135757.GB2222@kadam> List-Id: --===============4815923529888726660== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Mon, Feb 15, 2021 at 04:57:57PM +0300, Dan Carpenter wrote: > > > d715ff8acbd587 Guoqing Jiang 2020-10-23 1800 /* > > > d715ff8acbd587 Guoqing Jiang 2020-10-23 1801 * "refcount = =3D=3D 0" happens if a previous thread calls get_or_create_srv > > > d715ff8acbd587 Guoqing Jiang 2020-10-23 1802 * allocate s= rv, but chunks of srv are not allocated yet. > > > d715ff8acbd587 Guoqing Jiang 2020-10-23 1803 */ > > > f0751419d3a15f Md Haris Iqbal 2021-02-12 1804 if (IS_ERR(sr= v) || refcount_read(&srv->refcount) =3D=3D 0) { > > > f0751419d3a15f Md Haris Iqbal 2021-02-12 @1805 err = =3D PTR_ERR(srv); > > > > > > It's not 100% clear to me that an error code is required when > > > refcount_read() is zero. Maybe "err =3D 0;" is okay in that situatio= n? > > I don't see how srv can be zero > = > The cross function database was probably out of date. Regardless of if it is up to date or not, this sequence: if (refcount_read(&srv->refcount) =3D=3D 0) err =3D PTR_ERR(srv); Is completely bogus eg prove srv is a valid pointer by de-refing and then passing a valid pointer to PTR_ERR Jason --===============4815923529888726660==--