lkml.org 
[lkml]   [2008]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 20/24] perfmon: system calls interface

* eranian@googlemail.com <eranian@googlemail.com> wrote:

> +/*
> + * unlike the other perfmon system calls, this one returns a file descriptor
> + * or a value < 0 in case of error, very much like open() or socket()
> + */
> +asmlinkage long sys_pfm_create(int flags, struct pfarg_sinfo __user *ureq)
> +{
> + struct pfm_context *new_ctx;
> + struct pfarg_sinfo sif;
> + int ret;
> +
> + PFM_DBG("flags=0x%x sif=%p", flags, ureq);
> +
> + if (perfmon_disabled)
> + return -ENOSYS;

another gem. we check flags:

> + if (flags) {
> + PFM_DBG("no flags accepted yet");
> + return -EINVAL;
> + }

then we pass them into __pfm_create_context():

> + ret = __pfm_create_context(flags, &sif, &new_ctx);

where we check the flag _again_:

+ /* no context flags supported yet */
+ if (ctx_flags)
+ goto error_alloc;

btw., 'error_alloc' is misnamed: that label is not used for allocation
failure in this branch.

Ingo


\
 
 \ /
  Last update: 2008-11-26 15:15    [W:0.135 / U:2.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site