Hi,

This diff passes M_CANFAIL to malloc(9) calls which use M_WAITOK but are
tested for failure.  OK?

Index: sys/dev/usb/if_urndis.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_urndis.c,v
retrieving revision 1.65
diff -u -p -u -p -r1.65 if_urndis.c
--- sys/dev/usb/if_urndis.c     8 Apr 2017 02:57:25 -0000       1.65
+++ sys/dev/usb/if_urndis.c     9 Jun 2017 07:30:32 -0000
@@ -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 *s
        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                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_soft
        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 *s
        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_soft
        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;

Reply via email to