2009-12-29 05:55:26

by J. R. Okajima

[permalink] [raw]
Subject: Q. d_alloc() in pipe(2)


In pipe(2), create_write_pipe() creates a dentry by
struct qstr name = { .name = "" };
d_alloc(root, &name);

But d_alloc() refers name->len which is uninitialized.
Isn't it better to replace d_alloc() by d_alloc_name(root, "")?


J. R. Okajima


2009-12-29 15:01:11

by Cong Wang

[permalink] [raw]
Subject: Re: Q. d_alloc() in pipe(2)

On Tue, Dec 29, 2009 at 02:55:20PM +0900, [email protected] wrote:
>
>In pipe(2), create_write_pipe() creates a dentry by
> struct qstr name = { .name = "" };
> d_alloc(root, &name);
>
>But d_alloc() refers name->len which is uninitialized.

Well, it is initialized to 0. :)

>Isn't it better to replace d_alloc() by d_alloc_name(root, "")?
>

Maybe not, they totally equal in this case, IMO.

--
Live like a child, think like the god.

2009-12-30 03:41:53

by J. R. Okajima

[permalink] [raw]
Subject: Re: Q. d_alloc() in pipe(2)


Amrico Wang:
> >But d_alloc() refers name->len which is uninitialized.
>
> Well, it is initialized to 0. :)

I didn't know that.
Thanx.


J. R. Okajima

2009-12-31 03:04:22

by Bill Davidsen

[permalink] [raw]
Subject: Re: Q. d_alloc() in pipe(2)

[email protected] wrote:
> In pipe(2), create_write_pipe() creates a dentry by
> struct qstr name = { .name = "" };
> d_alloc(root, &name);
>
> But d_alloc() refers name->len which is uninitialized.
> Isn't it better to replace d_alloc() by d_alloc_name(root, "")?
>
If readability counts, I would say so. Functionally I don't know, I can't see
any problems other than it's unobvious.

--
Bill Davidsen <[email protected]>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot