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]
Date:	Mon, 7 Jan 2008 12:41:05 +0000
From:	Christoph Hellwig <hch@...radead.org>
To:	marcin.slusarz@...il.com
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Ben Fennema <bfennema@...con.csc.calpoly.edu>,
	Jan Kara <jack@...e.cz>, Christoph Hellwig <hch@...radead.org>
Subject: Re: [PATCH 3/7] udf: create common function for changing free
	space counter

On Sun, Jan 06, 2008 at 02:21:49AM +0100, marcin.slusarz@...il.com wrote:
> +static inline bool udf_inc_free_space(struct udf_sb_info *sbi,
> +				      u16 partition, u32 cnt)
> +{
> +	if (sbi->s_lvid_bh) {
> +		struct logicalVolIntegrityDesc *lvid =
> +					(struct logicalVolIntegrityDesc *)
> +							sbi->s_lvid_bh->b_data;
> +		lvid->freeSpaceTable[partition] =
> +			cpu_to_le32(le32_to_cpu(
> +					lvid->freeSpaceTable[partition]) + cnt);
> +	}
> +	return sbi->s_lvid_bh != NULL;
> +}

No need to mark helpers like this inline, the compiler will take care
of it if nessecary.  Also I'd add an early return for the sbi->s_lvid_bh
case and a local variable for the freespace to make the function better
readable:

static bool udf_inc_free_space(struct udf_sb_info *sbi, u16 partition,
		u32 cnt)
{
	struct logicalVolIntegrityDesc *lvid;

	if (!sbi->s_lvid_bh)
		return 0;

	lvid = (struct logicalVolIntegrityDesc *)sbi->s_lvid_bh->b_data;
	free = le32_to_cpu(lvid->freeSpaceTable[partition]) + cnt;
	lvid->freeSpaceTable[partition] = cpu_to_le32(free);
	return 1;
}
		

--
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