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: <20081017165300.GA8076@logfs.org>
Date:	Fri, 17 Oct 2008 18:53:00 +0200
From:	Jörn Engel <joern@...fs.org>
To:	Phillip Lougher <phillip@...gher.demon.co.uk>
Cc:	akpm@...ux-foundation.org, linux-embedded@...r.kernel.org,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	tim.bird@...sony.com
Subject: Re: Subject: [PATCH 01/16] Squashfs: inode operations

None of the comments below are a reason against mainline inclusion, imo.
They should get handled, but whether that happens before or after a
merge doesn't really matter.

On Fri, 17 October 2008 16:42:50 +0100, Phillip Lougher wrote:
> 
> +#include <linux/squashfs_fs.h>
> +#include <linux/squashfs_fs_sb.h>
> +#include <linux/squashfs_fs_i.h>

Current verdict seems to be that these files should live in fs/squashfs/,
not include/linux/.  No kernel code beside squashfs needs the headers
and userspace tools should have a private copy.

> +static int squashfs_new_inode(struct super_block *s, struct inode *i,
> +				struct squashfs_base_inode *inodeb)
> +{
> +	if (squashfs_get_id(s, le16_to_cpu(inodeb->uid), &i->i_uid) == 0)
> +		goto out;
> +	if (squashfs_get_id(s, le16_to_cpu(inodeb->guid), &i->i_gid) == 0)
> +		goto out;
> +
> +	i->i_ino = le32_to_cpu(inodeb->inode_number);
> +	i->i_mtime.tv_sec = le32_to_cpu(inodeb->mtime);
> +	i->i_atime.tv_sec = i->i_mtime.tv_sec;
> +	i->i_ctime.tv_sec = i->i_mtime.tv_sec;
> +	i->i_mode = le16_to_cpu(inodeb->mode);
> +	i->i_size = 0;
> +
> +	return 1;
> +
> +out:
> +	return 0;
> +}

Most code uses "sb" and "inode", which I consider easier to read - if
only for consistency.

> +int squashfs_read_inode(struct inode *i, long long inode)

Is your "long long inode" what most filesystems call "inode->i_ino"?  It
seems to be.

> +	if (squashfs_new_inode(s, i, inodeb) == 0)
> +			goto failed_read;

Most linux functions return 0 on success and -ESOMETHING on error.  You
return 0 on error and 1 on success.  That makes it likely for someone
else to do something like

	err = squashfs_foo(bar);
	if (err)
		goto fail;

Oops.

Jörn

-- 
Measure. Don't tune for speed until you've measured, and even then
don't unless one part of the code overwhelms the rest.
-- Rob Pike
--
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