lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1311666821.26957.13.camel@Joe-Laptop>
Date:	Tue, 26 Jul 2011 00:53:41 -0700
From:	Joe Perches <joe@...ches.com>
To:	"Nicholas A. Bellinger" <nab@...ux-iscsi.org>
Cc:	target-devel <target-devel@...r.kernel.org>,
	linux-scsi <linux-scsi@...r.kernel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Christoph Hellwig <hch@....de>,
	Andy Grover <agrover@...hat.com>,
	Hannes Reinecke <hare@...e.de>,
	Roland Dreier <roland@...estorage.com>,
	James Bottomley <James.Bottomley@...senPartnership.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH 1/2] kernel.h: Add DIV_ROUND_UP_ULL usage

On Tue, 2011-07-26 at 07:10 +0000, Nicholas A. Bellinger wrote:
> Add new DIV_ROUND_UP_ULL macro usage for 32-bit architectures requiring
> unsigned long long division of sectors * dev_max_sectors.
[]
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
[]
> +#define DIV_ROUND_UP_ULL(ll,d) \
> +	({ unsigned long long _tmp = (ll)+(d)-1; do_div(_tmp, d); _tmp; })

Maybe use uint64_t and a temporary for d?

#define DIV_ROUND_UP_ULL(ll, d)				\
({							\
	typeof(d) _d = d;				\
	uint64_t _tmp = (uint64_t)(ll) + _d - 1;	\
	do_div(_tmp, _d);				\
	_tmp;						\
})


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ