Skip to contentSkip to conversation

Q. d_alloc() in pipe(2)

DISCUSSION [email protected] 3 participants 4 messages Dec 29, 2009 – Dec 31, 2009

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 6 lines · 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. :)

Quoted 2 lines

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

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

Signature · 1 line
Live like a child, think like the god.
#2 lore raw

Amrico Wang:

Quoted 3 lines
Quoted 1 line

But d_alloc() refers name->len which is uninitialized.

Well, it is initialized to 0. :)

I didn't know that.
Thanx.

J. R. Okajima

#3 lore raw
In reply to [email protected]
Quoted 7 lines · [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.

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