From: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
To: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH 2/8] sysvshm: report error on failure to reattach, avoid crash
Date: Thu, 16 Sep 2010 20:17:05 -0400 [thread overview]
Message-ID: <4C92B381.7090407@cs.columbia.edu> (raw)
In-Reply-To: <20100915025502.GG8957-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
On 09/14/2010 10:55 PM, Matt Helsley wrote:
> On Tue, Sep 14, 2010 at 03:02:04PM -0500, Nathan Lynch wrote:
>> If ipcshm_restore fails to look up the file object for the region
>> being restored, it should return the error to its caller and not
>> proceed to dereference the file pointer.
>>
>> Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
>
> (Important fix. Adding Oren to Cc)
>
> Reviewed-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
>
>> ---
>> ipc/shm.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/ipc/shm.c b/ipc/shm.c
>> index eed4b9a..1ba9193 100644
>> --- a/ipc/shm.c
>> +++ b/ipc/shm.c
>> @@ -334,7 +334,7 @@ int ipcshm_restore(struct ckpt_ctx *ctx, struct mm_struct *mm,
>>
>> file = ckpt_obj_fetch(ctx, h->ino_objref, CKPT_OBJ_FILE);
>> if (IS_ERR(file))
>> - PTR_ERR(file);
>> + return PTR_ERR(file);
Hrm ... I really don't see what's the problem ;)
Oren.
>
> Odd that the original code didn't trigger any unused result or must check
> warnings. In linux/err.h I already see:
>
> static inline long __must_check PTR_ERR(const void *ptr)
> ...
>
> And in linux/compiler-gcc3.h
> if __GNUC_MINOR__ >= 4
> #define __must_check __attribute__((warn_unused_result))
> #endif
>
> or for those of us using GCC 4.x (linux/compiler-gcc4.h):
> #define __must_check __attribute__((warn_unused_result))
>
> and in my .config I have:
> CONFIG_SYSVIPC=y
> CONFIG_SYSVIPC_CHECKPOINT=y
> ...
> CONFIG_ENABLE_MUST_CHECK=y
>
> plus a simple test:
>
> #include <stdlib.h>
>
> static inline void * __attribute__((warn_unused_result)) foo(void)
> {
> return NULL;
> }
>
> int main (void)
> {
> if (0)
> foo();
> return 0;
> }
>
> even without -Wall triggers the compiler warning just fine. So I can't
> see why the warning is not triggering.
>
> Cheers,
> -Matt
>
next prev parent reply other threads:[~2010-09-17 0:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-14 20:02 [PATCH 0/8] checkpoint/restart: sysvshm fixes and hugetlb support Nathan Lynch
[not found] ` <1284494530-25946-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2010-09-14 20:02 ` [PATCH 1/8] sysvshm: check for hugetlb before assuming shmem Nathan Lynch
2010-09-14 20:02 ` [PATCH 2/8] sysvshm: report error on failure to reattach, avoid crash Nathan Lynch
[not found] ` <1284494530-25946-3-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2010-09-15 2:55 ` Matt Helsley
[not found] ` <20100915025502.GG8957-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2010-09-15 3:04 ` Matt Helsley
2010-09-17 0:17 ` Oren Laadan [this message]
2010-09-14 20:02 ` [PATCH 3/8] checkpoint/sysvshm: release rwsem earlier during restore Nathan Lynch
2010-09-14 20:02 ` [PATCH 4/8] checkpoint/ipc: allow shmat callers to specify ipc namespace Nathan Lynch
2010-09-14 20:02 ` [PATCH 5/8] checkpoint/restart of anonymous hugetlb mappings Nathan Lynch
[not found] ` <1284494530-25946-6-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2010-09-17 0:44 ` Oren Laadan
[not found] ` <4C92BA08.70106-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-09-17 20:23 ` Nathan Lynch
[not found] ` <1284754993.4109.397.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-11-01 17:44 ` Oren Laadan
2010-09-14 20:02 ` [PATCH 6/8] remove VM_HUGETLB and VM_RESERVED from CKPT_VMA_NOT_SUPPORTED Nathan Lynch
[not found] ` <1284494530-25946-7-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2010-09-17 3:35 ` Serge E. Hallyn
2010-09-14 20:02 ` [PATCH 7/8] hugetlbfs checkpoint/restart hooks Nathan Lynch
2010-09-14 20:02 ` [PATCH 8/8] checkpoint/restart of SysV SHM_HUGETLB regions Nathan Lynch
[not found] ` <1284494530-25946-9-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2010-09-17 0:40 ` Oren Laadan
[not found] ` <4C92B903.20304-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-09-17 19:03 ` Nathan Lynch
2010-09-17 0:37 ` [PATCH 0/8] checkpoint/restart: sysvshm fixes and hugetlb support Oren Laadan
[not found] ` <4C92B831.40400-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-10-06 19:43 ` Nathan Lynch
2010-11-01 17:45 ` Oren Laadan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C92B381.7090407@cs.columbia.edu \
--to=orenl-eqauephvms7envbuuze7ea@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
--cc=ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox