From 8b8ee40c2257a53ab384e78a82883b1c5041e7d4 Mon Sep 17 00:00:00 2001 From: christos Date: Fri, 14 Apr 2006 20:53:38 +0000 Subject: [PATCH] Coverity CID 1092: Get the status earlier to avoid NULL deref. --- sys/dev/ic/mlx.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/dev/ic/mlx.c b/sys/dev/ic/mlx.c index 3f431864eff7..fac7268fc6bc 100644 --- a/sys/dev/ic/mlx.c +++ b/sys/dev/ic/mlx.c @@ -1,4 +1,4 @@ -/* $NetBSD: mlx.c,v 1.39 2006/03/25 23:10:12 thorpej Exp $ */ +/* $NetBSD: mlx.c,v 1.40 2006/04/14 20:53:38 christos Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.39 2006/03/25 23:10:12 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.40 2006/04/14 20:53:38 christos Exp $"); #include "ld.h" @@ -1848,14 +1848,13 @@ mlx_user_command(struct mlx_softc *mlx, struct mlx_usercommand *mu) out: if (mc != NULL) { + /* Copy out status and data */ + mu->mu_status = mc->mc_status; if (mapped) mlx_ccb_unmap(mlx, mc); mlx_ccb_free(mlx, mc); } - /* Copy out status and data */ - mu->mu_status = mc->mc_status; - if (kbuf != NULL) { if (mu->mu_datasize > 0 && (mu->mu_bufdir & MU_XFER_IN) != 0) { rv = copyout(kbuf, mu->mu_buf, mu->mu_datasize);