Error in get_swap_page? (2.5.44)
Hi,
Unless I am mistaken, we return stuff (entry) from the local stack in swapfile.c::get_swap_page. Am I mistaken?
Code in question:
swp_entry_t get_swap_page(void)
{
struct swap_info_struct * p;
unsigned long offset;
swp_entry_t entry;
int type, wrapped = 0;
entry.val = 0; /* Out of memory */[...]
out:
swap_list_unlock();
return entry;
}Regards,
Rasmus
commence Rasmus Andersen quotation:
Quoted 2 lines
Unless I am mistaken, we return stuff (entry) from the local stack in
swapfile.c::get_swap_page. Am I mistaken?
Wouldn't this only be a problem if a *pointer* to it was being returned?
Quoted 16 lines
Code in question:
swp_entry_tget_swap_page(void){ struct swap_info_struct * p; unsigned long offset; swp_entry_t entry; int type, wrapped = 0; entry.val = 0; /* Out of memory */[...]
out:
swap_list_unlock(); return entry; }
Signature · 4 lines
/ | [|] Sean Neakums | Questions are a burden to others; [|] <[email protected]> | answers a prison for oneself. \ |
Quoted 7 lines · Sean Neakums
commence Rasmus Andersen quotation:
Quoted 2 lines
Unless I am mistaken, we return stuff (entry) from the local stack in
swapfile.c::get_swap_page. Am I mistaken?Wouldn't this only be a problem if a *pointer* to it was being returned?
Quite. Sorry about that. I'll be a good boy and go to bed now :)
Regards,
Rasmus
Quoted 2 lines · Rasmus Andersen
Unless I am mistaken, we return stuff (entry) from the local stack in
swapfile.c::get_swap_page. Am I mistaken?
Yes. This just returns a struct by value over the stack, which is frowned upon in some circles, but is not an error per se.
Regards,
bert
Signature · 2 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
Quoted 7 lines · bert hubert
Quoted 2 lines · Rasmus Andersen
Unless I am mistaken, we return stuff (entry) from the local stack in
swapfile.c::get_swap_page. Am I mistaken?Yes. This just returns a struct by value over the stack, which is frowned upon in some circles, but is not an error per se.
Hmm. You are right and I must be confused. -ENEEDSLEEP, apparently.
Thanks,
Rasmus