All of lore.kernel.org
 help / color / mirror / Atom feed
* Error in get_swap_page? (2.5.44)
@ 2002-10-20 19:32 Rasmus Andersen
  2002-10-20 19:36 ` Sean Neakums
  2002-10-20 19:36 ` bert hubert
  0 siblings, 2 replies; 5+ messages in thread
From: Rasmus Andersen @ 2002-10-20 19:32 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

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

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Error in get_swap_page? (2.5.44)
  2002-10-20 19:32 Error in get_swap_page? (2.5.44) Rasmus Andersen
@ 2002-10-20 19:36 ` Sean Neakums
  2002-10-20 19:41   ` Rasmus Andersen
  2002-10-20 19:36 ` bert hubert
  1 sibling, 1 reply; 5+ messages in thread
From: Sean Neakums @ 2002-10-20 19:36 UTC (permalink / raw)
  To: linux-kernel

commence  Rasmus Andersen quotation:

> 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?

> 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;
> }

-- 
 /                          |
[|] Sean Neakums            |  Questions are a burden to others;
[|] <sneakums@zork.net>     |      answers a prison for oneself.
 \                          |

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Error in get_swap_page? (2.5.44)
  2002-10-20 19:32 Error in get_swap_page? (2.5.44) Rasmus Andersen
  2002-10-20 19:36 ` Sean Neakums
@ 2002-10-20 19:36 ` bert hubert
  2002-10-20 19:39   ` Rasmus Andersen
  1 sibling, 1 reply; 5+ messages in thread
From: bert hubert @ 2002-10-20 19:36 UTC (permalink / raw)
  To: Rasmus Andersen; +Cc: linux-kernel

On Sun, Oct 20, 2002 at 09:32:17PM +0200, Rasmus Andersen wrote:

> 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

-- 
http://www.PowerDNS.com          Versatile DNS Software & Services
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Error in get_swap_page? (2.5.44)
  2002-10-20 19:36 ` bert hubert
@ 2002-10-20 19:39   ` Rasmus Andersen
  0 siblings, 0 replies; 5+ messages in thread
From: Rasmus Andersen @ 2002-10-20 19:39 UTC (permalink / raw)
  To: bert hubert, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]

On Sun, Oct 20, 2002 at 09:36:52PM +0200, bert hubert wrote:
> On Sun, Oct 20, 2002 at 09:32:17PM +0200, Rasmus Andersen wrote:
> 
> > 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

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Error in get_swap_page? (2.5.44)
  2002-10-20 19:36 ` Sean Neakums
@ 2002-10-20 19:41   ` Rasmus Andersen
  0 siblings, 0 replies; 5+ messages in thread
From: Rasmus Andersen @ 2002-10-20 19:41 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 403 bytes --]

On Sun, Oct 20, 2002 at 08:36:46PM +0100, Sean Neakums wrote:
> commence  Rasmus Andersen quotation:
> 
> > 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

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-10-20 19:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-20 19:32 Error in get_swap_page? (2.5.44) Rasmus Andersen
2002-10-20 19:36 ` Sean Neakums
2002-10-20 19:41   ` Rasmus Andersen
2002-10-20 19:36 ` bert hubert
2002-10-20 19:39   ` Rasmus Andersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.