From: Dan Carpenter <error27@gmail.com>
To: riel@redhat.com
Cc: linux-mm@kvack.org
Subject: smatch warning in mm/mmap.c
Date: Mon, 26 Apr 2010 12:03:05 +0200 [thread overview]
Message-ID: <20100426100305.GP29093@bicker> (raw)
Hi Rik,
This code generates a Smatch warning. I normally ignore Smatch warnings
in mm because I'm not clever enough to mess with that, but this one is
pretty recent so I thought I'd ask. Could you take a look?
mm/mmap.c +1980 __split_vma(57) error: we previously assumed 'new->vm_ops' could be null.
1966 if (new->vm_ops && new->vm_ops->open)
^^^^^^^^^^^
We assume new->vm_ops can be NULL here.
1967 new->vm_ops->open(new);
1968
1969 if (new_below)
1970 err = vma_adjust(vma, addr, vma->vm_end, vma->vm_pgoff +
1971 ((addr - new->vm_start) >> PAGE_SHIFT), new);
1972 else
1973 err = vma_adjust(vma, vma->vm_start, addr, vma->vm_pgoff, new);
1974
1975 /* Success. */
1976 if (!err)
1977 return 0;
1978
1979 /* Clean everything up if vma_adjust failed. */
1980 new->vm_ops->close(new);
^^^^^^^^^^^^^^^^^^
But we dereference it unconditionally here.
The dereference was added in 5beb4930: "mm: change anon_vma linking to fix
multi-process server scalability issue".
regards,
dan carpenter
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2010-04-26 10:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-26 10:03 Dan Carpenter [this message]
2010-04-26 16:33 ` [PATCH] mmap: check ->vm_ops before dereferencing Rik van Riel
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=20100426100305.GP29093@bicker \
--to=error27@gmail.com \
--cc=linux-mm@kvack.org \
--cc=riel@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).