git: e3885a7893d4 - main - soo_stat: Ensure error is always initialized.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 26 Aug 2022 18:19:37 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=e3885a7893d48f8d38cba427f3fb9a404d1bde23

commit e3885a7893d48f8d38cba427f3fb9a404d1bde23
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-08-26 18:17:55 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-08-26 18:17:55 +0000

    soo_stat: Ensure error is always initialized.
    
    In kernels without MAC, error is not set for sockets whose protocol
    layer does not implement the pr_sense hook.
    
    Reported by:    Jenkins (powerpc kernel builds)
    Fixes:          7c04ca1fad67 sockets: for stat(2) on a socket don't report hiwat as block size
---
 sys/kern/sys_socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c
index 5c10e2217686..3455cfee564c 100644
--- a/sys/kern/sys_socket.c
+++ b/sys/kern/sys_socket.c
@@ -303,7 +303,7 @@ static int
 soo_stat(struct file *fp, struct stat *ub, struct ucred *active_cred)
 {
 	struct socket *so = fp->f_data;
-	int error;
+	int error = 0;
 
 	bzero((caddr_t)ub, sizeof (*ub));
 	ub->st_mode = S_IFSOCK;