mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 16:56:26 +00:00
sysctl: Reduce dput(child) calls in proc_sys_fill_cache()
Replace two dput(child) calls with one that occurs immediately before the IS_ERR evaluation. This transformation can be performed because dput() gets called regardless of the value returned by IS_ERR(res). This issue was transformed by using a script for the semantic patch language like the following. <SmPL> @extended_adjustment@ expression e, f != { mutex_unlock }, x, y; @@ +f(e); if (...) { <+... when != \( e = x \| y(..., &e, ...) \) - f(e); ...+> } -f(e); </SmPL> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Reviewed-by: Joel Granados <joel.granados@kernel.org> Signed-off-by: Joel Granados <joel.granados@kernel.org>
This commit is contained in:
parent
a883f2efa6
commit
9c738dae95
@ -704,11 +704,11 @@ static bool proc_sys_fill_cache(struct file *file,
|
||||
res = d_splice_alias(inode, child);
|
||||
d_lookup_done(child);
|
||||
if (unlikely(res)) {
|
||||
if (IS_ERR(res)) {
|
||||
dput(child);
|
||||
return false;
|
||||
}
|
||||
dput(child);
|
||||
|
||||
if (IS_ERR(res))
|
||||
return false;
|
||||
|
||||
child = res;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user