From patchwork Tue May 29 20:49:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael J. Ruhl" X-Patchwork-Id: 10436971 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1EF6F601E9 for ; Tue, 29 May 2018 20:50:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BD72288DC for ; Tue, 29 May 2018 20:50:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F04F4288F7; Tue, 29 May 2018 20:50:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70219288DC for ; Tue, 29 May 2018 20:50:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966765AbeE2UuB convert rfc822-to-8bit (ORCPT ); Tue, 29 May 2018 16:50:01 -0400 Received: from mga07.intel.com ([134.134.136.100]:33155 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966175AbeE2UuA (ORCPT ); Tue, 29 May 2018 16:50:00 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 May 2018 13:49:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,457,1520924400"; d="scan'208";a="54927959" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga003.jf.intel.com with ESMTP; 29 May 2018 13:49:59 -0700 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 29 May 2018 13:49:59 -0700 Received: from fmsmsx108.amr.corp.intel.com ([169.254.9.131]) by FMSMSX155.amr.corp.intel.com ([169.254.5.48]) with mapi id 14.03.0319.002; Tue, 29 May 2018 13:49:59 -0700 From: "Ruhl, Michael J" To: Jason Gunthorpe CC: Leon Romanovsky , Doug Ledford , Leon Romanovsky , RDMA mailing list , Boris Pismenny , "Matan Barak" , Raed Salem , Yishai Hadas , Saeed Mahameed , linux-netdev Subject: RE: [PATCH rdma-next v2 01/13] IB/uverbs: Add an ib_uobject getter to ioctl() infrastructure Thread-Topic: [PATCH rdma-next v2 01/13] IB/uverbs: Add an ib_uobject getter to ioctl() infrastructure Thread-Index: AQHT905ZZsRu1QnYmUGR0jrD/TgMaKRHFtrQgACFFoD//5Fg4A== Date: Tue, 29 May 2018 20:49:58 +0000 Message-ID: <14063C7AD467DE4B82DEDB5C278E8663B38EE87B@FMSMSX108.amr.corp.intel.com> References: <20180529130917.13592-1-leon@kernel.org> <20180529130917.13592-2-leon@kernel.org> <14063C7AD467DE4B82DEDB5C278E8663B38ED738@FMSMSX108.amr.corp.intel.com> <20180529202119.GK18442@mellanox.com> In-Reply-To: <20180529202119.GK18442@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTFiMDAyYzUtMDRkOC00ZGRlLTg1MzctYmIwYTU0MDA5NDdlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiVGhhWTZaVmwwdVFJY0FQdDkxQ0w3MXdlMjJnUjNGVkhFZVwvT3BadmpEb2ZjWFVnWkQ1cU00UUdsK2l2QWJPRzgifQ== dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [10.1.200.107] MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP >-----Original Message----- >From: Jason Gunthorpe [mailto:jgg@mellanox.com] >Sent: Tuesday, May 29, 2018 4:21 PM >To: Ruhl, Michael J >Cc: Leon Romanovsky ; Doug Ledford >; Leon Romanovsky ; RDMA >mailing list ; Boris Pismenny >; Matan Barak ; Raed >Salem ; Yishai Hadas ; Saeed >Mahameed ; linux-netdev > >Subject: Re: [PATCH rdma-next v2 01/13] IB/uverbs: Add an ib_uobject getter >to ioctl() infrastructure > >On Tue, May 29, 2018 at 07:31:22PM +0000, Ruhl, Michael J wrote: >> >- struct ib_uverbs_destroy_cq_resp resp; >> > struct ib_uobject *uobj = >> >- uverbs_attr_get(attrs, >> >UVERBS_ATTR_DESTROY_CQ_HANDLE)->obj_attr.uobject; >> >- struct ib_ucq_object *obj = container_of(uobj, struct ib_ucq_object, >> >- uobject); >> >+ uverbs_attr_get_uobject(attrs, >> >UVERBS_ATTR_DESTROY_CQ_HANDLE); >> >+ struct ib_uverbs_destroy_cq_resp resp; >> >+ struct ib_ucq_object *obj; >> > int ret; >> > >> >+ if (IS_ERR(uobj)) >> >+ return PTR_ERR(uobj); >> >+ >> >> I remember a conversation that if an method attribute was mandatory, that >you did not need to >> test the uobj for error (since it was checked in the infrastructure). > >Yes. > >> Is this error check necessary? > >No > >But there is no way to check one way or the other at compile time >right now, and omitting the check makes smatch mad. Is smatch going to get mad at (same patch): If not, Reviewed-by: Michael J. Ruhl Thanks, Mike >We need some more patches to be able to safely omit the check... > >Jason --- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/core/uverbs_std_types_flow_action.c b/drivers/infiniband/core/uverbs_std_types_flow_action.c index b4f016dfa23d..a7be51cf2e42 100644 --- a/drivers/infiniband/core/uverbs_std_types_flow_action.c +++ b/drivers/infiniband/core/uverbs_std_types_flow_action.c @@ -320,7 +320,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_FLOW_ACTION_ESP_CREATE)(struct ib_device return ret; /* No need to check as this attribute is marked as MANDATORY */ - uobj = uverbs_attr_get(attrs, UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE)->obj_attr.uobject; + uobj = uverbs_attr_get_uobject(attrs, UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE); action = ib_dev->create_flow_action_esp(ib_dev, &esp_attr.hdr, attrs); if (IS_ERR(action)) return PTR_ERR(action); @@ -350,7 +350,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_FLOW_ACTION_ESP_MODIFY)(struct ib_device if (ret) return ret; - uobj = uverbs_attr_get(attrs, UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE)->obj_attr.uobject; + uobj = uverbs_attr_get_uobject(attrs, UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE); action = uobj->object; ?