linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* re: mm: frontswap: core code
@ 2011-08-30 21:47 Dan Carpenter
  2011-08-31 15:14 ` Dan Magenheimer
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-08-30 21:47 UTC (permalink / raw)
  To: dan.magenheimer; +Cc: linux-mm

Hello Dan Magenheimer,

This is a semi-automatic email to let you know that df0aade19b6a:
"mm: frontswap: core code" leads to the following Smatch complaint.

mm/frontswap.c +250 frontswap_curr_pages(7)
	 error: we previously assumed 'si' could be null (see line 252)

mm/frontswap.c
   249		spin_lock(&swap_lock);
   250		for (type = swap_list.head; type >= 0; type = si->next) {
                                                              ^^^^^^^^
Dereference.

   251			si = swap_info[type];
   252			if (si != NULL)
                            ^^^^^^^^^^
Check for NULL.

   253				totalpages += atomic_read(&si->frontswap_pages);
   254		}

These semi-automatic emails are in testing.  Let me know how they can
be improved.

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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* RE: mm: frontswap: core code
  2011-08-30 21:47 mm: frontswap: core code Dan Carpenter
@ 2011-08-31 15:14 ` Dan Magenheimer
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Magenheimer @ 2011-08-31 15:14 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-mm, Konrad Wilk

> From: Dan Carpenter [mailto:error27@gmail.com]
> Sent: Tuesday, August 30, 2011 3:47 PM
> To: Dan Magenheimer
> Cc: linux-mm@kvack.org
> Subject: re: mm: frontswap: core code
> 
> Hello Dan Magenheimer,
> 
> This is a semi-automatic email to let you know that df0aade19b6a:
> "mm: frontswap: core code" leads to the following Smatch complaint.
> 
> mm/frontswap.c +250 frontswap_curr_pages(7)
> 	 error: we previously assumed 'si' could be null (see line 252)
> 
> mm/frontswap.c
>    249		spin_lock(&swap_lock);
>    250		for (type = swap_list.head; type >= 0; type = si->next) {
>                                                               ^^^^^^^^
> Dereference.
> 
>    251			si = swap_info[type];
>    252			if (si != NULL)
>                             ^^^^^^^^^^
> Check for NULL.
> 
>    253				totalpages += atomic_read(&si->frontswap_pages);
>    254		}
> 
> These semi-automatic emails are in testing.  Let me know how they can
> be improved.
> 
> regards,
> dan carpenter

Thanks Dan!  On second look, the check for si against NULL is
unnecessary.  The "type >=0" guarantees that (and this idiom
for walking the list of swap devices is used elsewhere in the
swap subsystem).

Will fix it.

Dan

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2011-08-31 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-30 21:47 mm: frontswap: core code Dan Carpenter
2011-08-31 15:14 ` Dan Magenheimer

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).