Commit f29623e
mm: memory-failure: fix potential unexpected return value from unpoison_memory()
If unpoison_memory() fails to clear page hwpoisoned flag, return value ret
is expected to be -EBUSY. But when get_hwpoison_page() returns 1 and
fails to clear page hwpoisoned flag due to races, return value will be
unexpected 1 leading to users being confused. And there's a code smell
that the variable "ret" is used not only to save the return value of
unpoison_memory(), but also the return value from get_hwpoison_page().
Make a further cleanup by using another auto-variable solely to save the
return value of get_hwpoison_page() as suggested by Naoya.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: bf181c5 ("mm/hwpoison: fix unpoison_memory()")
Signed-off-by: Miaohe Lin <[email protected]>
Cc: Kefeng Wang <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: Naoya Horiguchi <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>1 parent f985fc3 commit f29623e
1 file changed
+9
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2466 | 2466 | | |
2467 | 2467 | | |
2468 | 2468 | | |
2469 | | - | |
| 2469 | + | |
2470 | 2470 | | |
2471 | 2471 | | |
2472 | 2472 | | |
| |||
2514 | 2514 | | |
2515 | 2515 | | |
2516 | 2516 | | |
2517 | | - | |
2518 | | - | |
| 2517 | + | |
| 2518 | + | |
2519 | 2519 | | |
2520 | 2520 | | |
2521 | 2521 | | |
2522 | | - | |
2523 | | - | |
| 2522 | + | |
2524 | 2523 | | |
2525 | | - | |
2526 | 2524 | | |
2527 | 2525 | | |
2528 | | - | |
2529 | | - | |
| 2526 | + | |
| 2527 | + | |
2530 | 2528 | | |
2531 | | - | |
| 2529 | + | |
| 2530 | + | |
2532 | 2531 | | |
2533 | 2532 | | |
| 2533 | + | |
2534 | 2534 | | |
2535 | 2535 | | |
2536 | 2536 | | |
2537 | 2537 | | |
2538 | 2538 | | |
2539 | | - | |
2540 | 2539 | | |
2541 | 2540 | | |
2542 | 2541 | | |
| |||
0 commit comments