From d5bd7054751be1d676f13da2897d8c06be2da6e8 Mon Sep 17 00:00:00 2001 From: kevlo Date: Sat, 10 Jun 2017 12:58:37 +0000 Subject: [PATCH] Pass M_CANFAIL to malloc(9) calls which use M_WAITOK but are tested for failure. ok armani@ --- sys/dev/usb/if_urndis.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/dev/usb/if_urndis.c b/sys/dev/usb/if_urndis.c index 21821f9cf71..4af6b55cf05 100644 --- a/sys/dev/usb/if_urndis.c +++ b/sys/dev/usb/if_urndis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urndis.c,v 1.65 2017/04/08 02:57:25 deraadt Exp $ */ +/* $OpenBSD: if_urndis.c,v 1.66 2017/06/10 12:58:37 kevlo Exp $ */ /* * Copyright (c) 2010 Jonathan Armani @@ -408,7 +408,7 @@ urndis_ctrl_init(struct urndis_softc *sc) u_int32_t rval; struct rndis_comp_hdr *hdr; - msg = malloc(sizeof(*msg), M_TEMP, M_WAITOK); + msg = malloc(sizeof(*msg), M_TEMP, M_WAITOK | M_CANFAIL); if (msg == NULL) { printf("%s: out of memory\n", DEVNAME(sc)); return RNDIS_STATUS_FAILURE; @@ -454,7 +454,7 @@ urndis_ctrl_halt(struct urndis_softc *sc) struct rndis_halt_req *msg; u_int32_t rval; - msg = malloc(sizeof(*msg), M_TEMP, M_WAITOK); + msg = malloc(sizeof(*msg), M_TEMP, M_WAITOK | M_CANFAIL); if (msg == NULL) { printf("%s: out of memory\n", DEVNAME(sc)); return RNDIS_STATUS_FAILURE; @@ -488,7 +488,7 @@ urndis_ctrl_query(struct urndis_softc *sc, u_int32_t oid, u_int32_t rval; struct rndis_comp_hdr *hdr; - msg = malloc(sizeof(*msg) + qlen, M_TEMP, M_WAITOK); + msg = malloc(sizeof(*msg) + qlen, M_TEMP, M_WAITOK | M_CANFAIL); if (msg == NULL) { printf("%s: out of memory\n", DEVNAME(sc)); return RNDIS_STATUS_FAILURE; @@ -541,7 +541,7 @@ urndis_ctrl_set(struct urndis_softc *sc, u_int32_t oid, void *buf, size_t len) u_int32_t rval; struct rndis_comp_hdr *hdr; - msg = malloc(sizeof(*msg) + len, M_TEMP, M_WAITOK); + msg = malloc(sizeof(*msg) + len, M_TEMP, M_WAITOK | M_CANFAIL); if (msg == NULL) { printf("%s: out of memory\n", DEVNAME(sc)); return RNDIS_STATUS_FAILURE; @@ -605,7 +605,7 @@ urndis_ctrl_set_param(struct urndis_softc *sc, else namelen = 0; tlen = sizeof(*param) + len + namelen; - param = malloc(tlen, M_TEMP, M_WAITOK); + param = malloc(tlen, M_TEMP, M_WAITOK | M_CANFAIL); if (param == NULL) { printf("%s: out of memory\n", DEVNAME(sc)); return RNDIS_STATUS_FAILURE; @@ -651,7 +651,7 @@ urndis_ctrl_reset(struct urndis_softc *sc) u_int32_t rval; struct rndis_comp_hdr *hdr; - reset = malloc(sizeof(*reset), M_TEMP, M_WAITOK); + reset = malloc(sizeof(*reset), M_TEMP, M_WAITOK | M_CANFAIL); if (reset == NULL) { printf("%s: out of memory\n", DEVNAME(sc)); return RNDIS_STATUS_FAILURE; @@ -691,7 +691,7 @@ urndis_ctrl_keepalive(struct urndis_softc *sc) u_int32_t rval; struct rndis_comp_hdr *hdr; - keep = malloc(sizeof(*keep), M_TEMP, M_WAITOK); + keep = malloc(sizeof(*keep), M_TEMP, M_WAITOK | M_CANFAIL); if (keep == NULL) { printf("%s: out of memory\n", DEVNAME(sc)); return RNDIS_STATUS_FAILURE; -- 2.20.1