Subject: Re: CVS commit: src/sys/uvm
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Christos Zoulas <christos@zoulas.com>
List: source-changes
Date: 04/12/2006 21:32:41
On Apr 13, 10:21am, yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi) wrote:
-- Subject: Re: CVS commit: src/sys/uvm

| > Module Name:	src
| > Committed By:	christos
| > Date:		Thu Apr 13 01:05:17 UTC 2006
| > 
| > Modified Files:
| > 	src/sys/uvm: uvm_pager.c
| > 
| > Log Message:
| > Coverity CID 835: Check before dereferencing pg->uanon.
| > 
| > 
| > To generate a diff of this commit:
| > cvs rdiff -r1.75 -r1.76 src/sys/uvm/uvm_pager.c
| 
| i don't think it can be NULL.  please make it an assertion.

Well, 

	   swap = (pg->uanon != NULL && pg->uobject == NULL) ||
	       (pg->pqflags & PQ_AOBJ) != 0;
	   if (!swap) {
		...
	   } else {
		
		if (pg->uobject != NULL) {
// (pg->pqflags & PQ_AOBJ) != 0 then and we don't know about
// pg->uanon...
			swslot = uao_find_swslot(pg->uobject,
			    pg->offset >> PAGE_SHIFT);
		} else if (pg->uanon != NULL) {
			swslot = pg->uanon->an_swslot;
		}
		KASSERT(swslot);

So should we make the swap condition more precise? Anyway we are going
to die in the KASSERT(swslot) immediately if pg->uanon == NULL. Is it
worth adding another KASSERT?

christos