Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/uvm



On Apr 13, 10:21am, yamt%mwd.biglobe.ne.jp@localhost (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



Home | Main Index | Thread Index | Old Index