Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp523542ybi; Fri, 7 Jun 2019 12:00:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjxpaoF8rtY19aO7MluycRBqJsy5zBw/k6Gr+twG07+iRSvajDVn5UP0QNfIB0pNfpKOUu X-Received: by 2002:a17:90a:2163:: with SMTP id a90mr7114705pje.3.1559934026872; Fri, 07 Jun 2019 12:00:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559934026; cv=none; d=google.com; s=arc-20160816; b=tMN1FvP/7IxnJ+dJI+u+s0o1pNFiwO0Y1YUI3b8HAsYc9JbzfTa1fEdAujmmKtxywg cg7sd3mQCQic69Ftu2RIHnDc+AVEFHyMt1kfE3SzhbA73T9/Sa1Tdh6FJWegN0xTm3RG ZhP/8hucq8WxpD+QkZJUe9lN5pjnfg7qF8osHCYuc0nhLab/9csjHOjAuGR0ONLPhtxk /Kdh2HiyIzI4uoonSf+GiKJWwD2g+2Tbmehq8dhY4mCBSnUHAXBkYeKp1VfQhOQI7rFJ qeu/AwTNA3KhoCLKV+2YJ8F55PMdBOT5b3iU2OJiwjxMq9FTLYuTNO3ie8CaKkMTZ6ut bTTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1u8QA5gDOKeNLVCd2bIEH+QLN4jvjcMRS9RX5LydFVo=; b=Y//rDSNGdHkq7Ngqs/2VcLWVUEXFj0uWtZIS2RESgLc0sc82lZmlsFsqiPLgFvDOqm T6exPMlWKvd8DCf89IJ2+qv1mNo1AO69XryLpvsaRhrw23x+411arV1BOL1KD0LtN+vE 2q8w/wWRAq/kwxJcZfeQ3XYhgbRRZxaT+JNwGH25175Ccu1wNh7h5BhOEPrEbijc6Ktm nYb0a1n8GXq24kyeYBYiFWTCZakjq7lL3fDbyFLS2ZCcaFpjq+NTs+T6sJUolhngsxmS 9+ROIC0DTrnE+k7Sze0XjfL5q0uM86DZL5YGtg63ng4+zXf4BQQth1znArqrGIYAB6U7 XeQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=EZ20ECrH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id go16si2689967plb.317.2019.06.07.12.00.10; Fri, 07 Jun 2019 12:00:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=EZ20ECrH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731782AbfFGSFK (ORCPT + 99 others); Fri, 7 Jun 2019 14:05:10 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:43933 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729921AbfFGSFK (ORCPT ); Fri, 7 Jun 2019 14:05:10 -0400 Received: by mail-qt1-f196.google.com with SMTP id z24so3301411qtj.10 for ; Fri, 07 Jun 2019 11:05:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=1u8QA5gDOKeNLVCd2bIEH+QLN4jvjcMRS9RX5LydFVo=; b=EZ20ECrHM9ckS09YSKff5zWQ4PQXOp2h3ff9oZ8Yz1H0GRPOYbX/p4Q/p6elbds5Ho Dervbbi1ZXm+hC1mme6oG/EF2SslLChrdLL9aaOJTlo04u1OWPPiCRq2t96ZDZQb3dGQ nrkDFXm5UKgGSbnkKT80uvxIl+g505IYmvsBgVR7C0R1ntFng+00hvy4Husorjg91trl X7Kp3pvDUZNzzG4k3gGGDYPirrVpqz05FrFBoaAsDisDVZXnGMON86CRHcoK/pMy2BHe i8paEjz3b+IwtyYXPrQ+g2usQYJgNu2cTPuDsaYgOlbvjU84YljcMISrvLTjp1BfSWeH V/2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=1u8QA5gDOKeNLVCd2bIEH+QLN4jvjcMRS9RX5LydFVo=; b=dZ2x5uR2GflmL4kl621roecvUp6Nsm6LWjnk6FJzxtaVwcfTW4+hQmbGhrL7EKQ7AU 9/zP4qMyTFKFUtkA06q6YIPT+rdq/SZB8HZHGEmyag5GWTNTJBCK1ZE1//Q+IvVozT3m /EY2iKTcDgxZ5oIkHibXxer3ueNCzKxHrrnwhGEv1O/nxCs4Z215DdBkZWWj69ZUJ9Sm admTU40FSESvJYibUlHPExAxr3GhPw9GKL3KFHNZZk5q7aBnPwPkrv8hIwGCW8z1rb+h Zexl8M8F+HQARgpAPGz/Rr9KM4qpdqcDoudvT/Nm28wMEnOhP2do3k30qF5Fo8DFe7Xw w1nw== X-Gm-Message-State: APjAAAW7vnXEREIX+gqhji41ehqwSgC4YxQ6dq7mws7RzftuGw9okFpX J8x0bSieBcrlgni5COYztOJAoQ== X-Received: by 2002:aed:2961:: with SMTP id s88mr46611186qtd.120.1559930709358; Fri, 07 Jun 2019 11:05:09 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-55-100.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.55.100]) by smtp.gmail.com with ESMTPSA id k7sm1167641qth.88.2019.06.07.11.05.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 11:05:08 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hZJEi-0007ai-Gq; Fri, 07 Jun 2019 15:05:08 -0300 Date: Fri, 7 Jun 2019 15:05:08 -0300 From: Jason Gunthorpe To: "Gustavo A. R. Silva" Cc: Doug Ledford , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] RDMA/ucma: Use struct_size() helper Message-ID: <20190607180508.GA29136@ziepe.ca> References: <20190604154222.GA8938@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190604154222.GA8938@embeddedor> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 04, 2019 at 10:42:22AM -0500, Gustavo A. R. Silva wrote: > Make use of the struct_size() helper instead of an open-coded version > in order to avoid any potential type mistakes, in particular in the > context in which this code is being used. > > So, replace the following form: > > sizeof(*resp) + (i * sizeof(struct ib_path_rec_data)) > > with: > > struct_size(resp, path_data, i) > > This code was detected with the help of Coccinelle. > > Signed-off-by: Gustavo A. R. Silva > --- > drivers/infiniband/core/ucma.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) Applied to for-next, thanks Jason