From: Samuel Cabrero Date: Fri, 18 Dec 2020 09:29:49 +0000 (+0100) Subject: cifs: Avoid error pointer dereference X-Git-Tag: xarray-5.12~648^2~2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0bf1bafb17df03fbd0e8b9a086c39e6f24af7193;p=users%2Fwilly%2Fxarray.git cifs: Avoid error pointer dereference The patch 7d6535b72042: "cifs: Simplify reconnect code when dfs upcall is enabled" leads to the following static checker warning: fs/cifs/connect.c:160 reconn_set_next_dfs_target() error: 'server->hostname' dereferencing possible ERR_PTR() Avoid dereferencing the error pointer by early returning on error condition. Reported-by: Dan Carpenter Signed-off-by: Samuel Cabrero Signed-off-by: Steve French --- diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 509a41ff56b8..b9df85506938 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -155,6 +155,7 @@ static void reconn_set_next_dfs_target(struct TCP_Server_Info *server, cifs_dbg(FYI, "%s: failed to extract hostname from target: %ld\n", __func__, PTR_ERR(server->hostname)); + return; } rc = reconn_set_ipaddr_from_hostname(server);