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:	Fri, 1 Sep 2006 14:44:23 -0700
From:	Andrew Morton <akpm@...l.org>
To:	Andreas Gruenbacher <agruen@...e.de>
Cc:	linux-kernel@...r.kernel.org, James Morris <jmorris@...ei.org>,
	Kay Sievers <kay.sievers@...y.org>
Subject: Re: Generic infrastructure for acls

On Sat, 02 Sep 2006 00:14:22 +0200
Andreas Gruenbacher <agruen@...e.de> wrote:

> +generic_acl_list(struct inode *inode, struct generic_acl_operations *ops,
> +		 int type, char *list, size_t list_size)
> +{
> +	struct posix_acl *acl;
> +	const char *name;
> +	size_t size;
> +
> +	acl = ops->getacl(inode, type);
> +	if (!acl)
> +		return 0;
> +	posix_acl_release(acl);
> +
> +	switch(type) {
> +		case ACL_TYPE_ACCESS:
> +			name = POSIX_ACL_XATTR_ACCESS;
> +			break;
> +
> +		case ACL_TYPE_DEFAULT:
> +			name = POSIX_ACL_XATTR_DEFAULT;
> +			break;
> +
> +		default:
> +			return 0;
> +	}
> +	size = strlen(name) + 1;
> +	if (list && size <= list_size)
> +		memcpy(list, name, size);
> +	return size;
> +}

That's a clumsy-looking interface.  How is the caller to know that *list
got filled in?  By checking the generic_acl_list() return value against
`list_size'?

If so, shouldn't this be covered in the API description (when you write
it ;))?

Or should it be returning some error code in this case?

Or should we just strdup() the thing?

Or return `name' and let the caller worry about it?

-- 
VGER BF report: H 1.83187e-15
-
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