Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3369515imu; Mon, 19 Nov 2018 15:04:32 -0800 (PST) X-Google-Smtp-Source: AJdET5fiXNnTWEU/zeBrT4DA45oQvkUide1X36qfJALULqukKsue20QLT0J8GffSYZ/glGhDPhuC X-Received: by 2002:a63:6483:: with SMTP id y125mr21555135pgb.91.1542668672386; Mon, 19 Nov 2018 15:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542668672; cv=none; d=google.com; s=arc-20160816; b=gRYBPpgrZ7i9kKYufRBcqJxCEGzaTJjHPQhT51/1KqvFgpiWCzWCr/WzXgi40nYjwL i6Ad4c2azKMTvD5ds9Ni/Jr1ujygf40udX1I6yrXGWKf7bxnV1AnOaeC6CNftt2r0nHq 3vlpCW0XWI8+E7JpTRurMXJFL1R0QnWnh/J+3v5eWjh2i9mLIsE1le2GaavEMZ6Avwcf fzaRNd54x+AaorzJ4jgo4SW2Sjf5yEZph8wwVhFHgZgNGNFnsr1CBCwShg/atq1Rs2Xl M0Y3CEQXmjBWQ4e3cEK+PqfDY4ffktTHNwW8S0lsY3M5kLK8EqlU5ZRcj/7db/EPFNbf P2Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=WpPo/D52O+/8c4gAOEYgeU/Lw/EUB+LnRFrdAH1KE6U=; b=Bw+yEUv788yLHCjGnv3EfpzTEGe3wqCtiIS3B9GTLPM5lUD+hGbvHfB5gr5zsCY66O jAtQK4wgKm2kv7Z0aSB/0KwSzVBWgpkOyMi8tLO1XXsCn4Dlvupsv5zSUfT123tTHdcO 0k5eCzuVV/nTs5EA69nCR46FaFPYFwxUl6Z4lnKBO8dIQIEa3NIcBw7S+8FDUgBdfv8u hM93IFRcEpDZHSuLPqV+oiW8HMZ2KV14guQcwQn7ROrlTzsy29Y8C8DC079WpD6yW196 f+I67ZQcdaEAJy3sCumr9kJnOPDMevPSKSEfB2+Zki6qX4rwq3esUw1HZ102h0Cr6qN3 Zyuw== ARC-Authentication-Results: i=1; mx.google.com; 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 w7si21610163ply.421.2018.11.19.15.04.17; Mon, 19 Nov 2018 15:04:32 -0800 (PST) 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; 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 S1731924AbeKTJ1k (ORCPT + 99 others); Tue, 20 Nov 2018 04:27:40 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:52862 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731164AbeKTJ1k (ORCPT ); Tue, 20 Nov 2018 04:27:40 -0500 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::bf5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 9E2D114E10BF9; Mon, 19 Nov 2018 15:01:43 -0800 (PST) Date: Mon, 19 Nov 2018 15:01:42 -0800 (PST) Message-Id: <20181119.150142.777293649598457239.davem@davemloft.net> To: xuechaojing@huawei.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, wulike1@huawei.com, chiqijun@huawei.com, fy.wang@huawei.com, tony.qu@huawei.com, luoshaokai@huawei.com Subject: Re: [PATCH 1/4] net-next/hinic:replace multiply and division operators From: David Miller In-Reply-To: <20181119061234.12839-1-xuechaojing@huawei.com> References: <20181119061234.12839-1-xuechaojing@huawei.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 19 Nov 2018 15:01:43 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xue Chaojing Date: Mon, 19 Nov 2018 06:12:31 +0000 > @@ -530,7 +536,9 @@ int hinic_wq_allocate(struct hinic_wqs *wqs, struct hinic_wq *wq, > return -EINVAL; > } > > - num_wqebbs_per_page = ALIGN(wq_page_size, wqebb_size) / wqebb_size; > + wqebb_size_shift = ilog2(wqebb_size); You now have introduced the assumption that these various sizes are a power of two. You should check for this, either at compile time or at run time, in order to avoid surprises and hard to debug issues in the future. Thank you.