From patchwork Sun Jun 5 07:43:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 9155207 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 2EA2160467 for ; Sun, 5 Jun 2016 10:19:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20D7227C8F for ; Sun, 5 Jun 2016 10:19:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14FFA281DB; Sun, 5 Jun 2016 10:19:07 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3A23227C8F for ; Sun, 5 Jun 2016 10:19:04 +0000 (UTC) Received: from localhost ([::1]:36377 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9V95-000596-Pc for patchwork-qemu-devel@patchwork.kernel.org; Sun, 05 Jun 2016 06:19:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9V21-0007Yw-Ee for qemu-devel@nongnu.org; Sun, 05 Jun 2016 06:11:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9V1o-0003E5-0X for qemu-devel@nongnu.org; Sun, 05 Jun 2016 06:11:44 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:55513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9V1n-0003Df-Ob; Sun, 05 Jun 2016 06:11:31 -0400 Received: from tsrv.tls.msk.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 27FA6408D7; Sun, 5 Jun 2016 13:11:28 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.tls.msk.ru (Postfix) with SMTP id 9C223AFC; Sun, 5 Jun 2016 10:43:37 +0300 (MSK) Received: (nullmailer pid 1190 invoked by uid 1000); Sun, 05 Jun 2016 07:43:32 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Sun, 5 Jun 2016 10:43:26 +0300 Message-Id: <7841668a37c7193704c620e29ad7586ce3de95e6.1465112552.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 49/52] linux-user: Use DIV_ROUND_UP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , qemu-trivial@nongnu.org, Riku Voipio , Michael Tokarev Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Laurent Vivier Replace (((n) + (d) - 1) /(d)) by DIV_ROUND_UP(n,d). This patch is the result of coccinelle script scripts/coccinelle/round.cocci CC: Riku Voipio Signed-off-by: Laurent Vivier Signed-off-by: Michael Tokarev --- linux-user/syscall.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index df70255..96ec801 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -829,7 +829,7 @@ static inline abi_long copy_from_user_fdset(fd_set *fds, int i, nw, j, k; abi_ulong b, *target_fds; - nw = (n + TARGET_ABI_BITS - 1) / TARGET_ABI_BITS; + nw = DIV_ROUND_UP(n, TARGET_ABI_BITS); if (!(target_fds = lock_user(VERIFY_READ, target_fds_addr, sizeof(abi_ulong) * nw, @@ -876,7 +876,7 @@ static inline abi_long copy_to_user_fdset(abi_ulong target_fds_addr, abi_long v; abi_ulong *target_fds; - nw = (n + TARGET_ABI_BITS - 1) / TARGET_ABI_BITS; + nw = DIV_ROUND_UP(n, TARGET_ABI_BITS); if (!(target_fds = lock_user(VERIFY_WRITE, target_fds_addr, sizeof(abi_ulong) * nw,