Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18495614ybl; Fri, 3 Jan 2020 03:32:47 -0800 (PST) X-Google-Smtp-Source: APXvYqxKzI/YR9HS8hH768wl1mxmsA5ISxtKObKpAr0WTj+YLomDqK2xxbXtUotw/na0Q+9Jj5pQ X-Received: by 2002:a05:6830:194:: with SMTP id q20mr101739874ota.92.1578051167661; Fri, 03 Jan 2020 03:32:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578051167; cv=none; d=google.com; s=arc-20160816; b=0kMZnEqBHpjt1mYY+mUiKz2Jwu3GNTFNINOKnDwyrcRRv4v6EhzrsuqhQzIMk9x8RE gIhcbZN/V3GlzhkBZHABxUWS4YPOcbwujdFy8SIAH/JtrWYa1t47FGaD3QFgVbY/FUUa 43mEfw2wigwyLqbOQBPIDsKdGnG0jODzUpAx4AHLt+A4xmUWoVxGoCT6PQBViTU5a8tG HMQR29nyqqmGN4BYSsOwhYcxhU5n4Ltui9R5niq0N/ZG28p3M+o3ZccX2hnAoUHGZzIy jnof1IL4usycTJrsjQ68qDNeZaUW4EwrwBIJ2F+OriFN0WQ4/cXj1R9PoyFr0gRVOnCD /7lw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=kaY2MYSfbvsn9sO+dGtqNJj766Y8VUtIa4DdYwSjOJw=; b=EGLvWDYFbWaToMtx+l04euggKdRs/QYjVWR1yFKbZUSGV04YfMmObErLpWg0a650Zh oa8SaEvX9SX8xHjbcH9qAdd8wD14wJUVPG1sJoRSvNg6jaZTmuNaTUCCU9Jx6iUiAom1 /8z6QG/WmEAkHqs9X2ZiFnXe0/ueLQL6m588Piw51SlRBdBxAZHM2uiYOBFqudTsZeP/ AHcN33lOXJpKi0CsErwrOjpn/BxuLpM8JWGwmZthpymowNiuQJ7t9XChzkJRzdN80tLZ +r6oYePpYiIZ0tG30VucieRvewAtSfR9nnLMP/9Zr/gRTvKSwG5FX6K3E8cWxy9CkfKH Ur7w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b4si18301606oib.70.2020.01.03.03.32.35; Fri, 03 Jan 2020 03:32:47 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727545AbgACLbx (ORCPT + 99 others); Fri, 3 Jan 2020 06:31:53 -0500 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:41083 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727453AbgACLbx (ORCPT ); Fri, 3 Jan 2020 06:31:53 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R821e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07487;MF=wenyang@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0TmjiLWd_1578051110; Received: from IT-C02W23QPG8WN.local(mailfrom:wenyang@linux.alibaba.com fp:SMTPD_---0TmjiLWd_1578051110) by smtp.aliyun-inc.com(127.0.0.1); Fri, 03 Jan 2020 19:31:51 +0800 Subject: Re: [PATCH v2] ftrace: avoid potential division by zero To: Justin Capella Cc: Steven Rostedt , Ingo Molnar , xlpang@linux.alibaba.com, LKML References: <20200103030248.14516-1-wenyang@linux.alibaba.com> From: Wen Yang Message-ID: Date: Fri, 3 Jan 2020 19:31:49 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/1/3 4:00 下午, Justin Capella wrote: >> - do_div(stddev, rec->counter * (rec->counter - 1) * 1000); >> >> + stddev = div64_ul(stddev, >> + rec->counter * (rec->counter - 1) * 1000); > > > Is a rec->counter > 1 assertion needed here? > Hello, the above lines deal with this situation: if (rec->counter <= 1) stddev = 0; else { -- Regards, Wen