View | Details | Raw Unified | Return to bug 240545 | Differences between
and this patch

Collapse All | Expand All

(-)sys/cam/ctl/ctl.c (-6 lines)
Lines 2645-2656 Link Here
2645
		}
2645
		}
2646
2646
2647
		entries = malloc(ooa_hdr->alloc_len, M_CTL, M_WAITOK | M_ZERO);
2647
		entries = malloc(ooa_hdr->alloc_len, M_CTL, M_WAITOK | M_ZERO);
2648
		if (entries == NULL) {
2649
			printf("%s: could not allocate %d bytes for OOA "
2650
			       "dump\n", __func__, ooa_hdr->alloc_len);
2651
			retval = ENOMEM;
2652
			break;
2653
		}
2654
2648
2655
		mtx_lock(&softc->ctl_lock);
2649
		mtx_lock(&softc->ctl_lock);
2656
		if ((ooa_hdr->flags & CTL_OOA_FLAG_ALL_LUNS) == 0 &&
2650
		if ((ooa_hdr->flags & CTL_OOA_FLAG_ALL_LUNS) == 0 &&
(-)sys/compat/linuxkpi/common/src/linux_usb.c (-10 / +7 lines)
Lines 1008-1023 Link Here
1008
	}
1008
	}
1009
1009
1010
	urb = malloc(size, M_USBDEV, M_WAITOK | M_ZERO);
1010
	urb = malloc(size, M_USBDEV, M_WAITOK | M_ZERO);
1011
	if (urb) {
1011
	cv_init(&urb->cv_wait, "URBWAIT");
1012
1012
	if (iso_packets == 0xFFFF) {
1013
		cv_init(&urb->cv_wait, "URBWAIT");
1013
		urb->setup_packet = (void *)(urb + 1);
1014
		if (iso_packets == 0xFFFF) {
1014
		urb->transfer_buffer = (void *)(urb->setup_packet +
1015
			urb->setup_packet = (void *)(urb + 1);
1015
		    sizeof(struct usb_device_request));
1016
			urb->transfer_buffer = (void *)(urb->setup_packet +
1016
	} else {
1017
			    sizeof(struct usb_device_request));
1017
		urb->number_of_packets = iso_packets;
1018
		} else {
1019
			urb->number_of_packets = iso_packets;
1020
		}
1021
	}
1018
	}
1022
	return (urb);
1019
	return (urb);
1023
}
1020
}
(-)sys/dev/drm2/i915/intel_overlay.c (-2 lines)
Lines 1065-1072 Link Here
1065
	}
1065
	}
1066
1066
1067
	params = malloc(sizeof(struct put_image_params), DRM_I915_GEM, M_WAITOK);
1067
	params = malloc(sizeof(struct put_image_params), DRM_I915_GEM, M_WAITOK);
1068
	if (!params)
1069
		return -ENOMEM;
1070
1068
1071
	drmmode_obj = drm_mode_object_find(dev, put_image_rec->crtc_id,
1069
	drmmode_obj = drm_mode_object_find(dev, put_image_rec->crtc_id,
1072
					   DRM_MODE_OBJECT_CRTC);
1070
					   DRM_MODE_OBJECT_CRTC);
(-)sys/dev/drm2/i915/intel_ringbuffer.c (-2 lines)
Lines 450-457 Link Here
450
		return 0;
450
		return 0;
451
451
452
	pc = malloc(sizeof(*pc), DRM_I915_GEM, M_WAITOK);
452
	pc = malloc(sizeof(*pc), DRM_I915_GEM, M_WAITOK);
453
	if (!pc)
454
		return -ENOMEM;
455
453
456
	obj = i915_gem_alloc_object(ring->dev, 4096);
454
	obj = i915_gem_alloc_object(ring->dev, 4096);
457
	if (obj == NULL) {
455
	if (obj == NULL) {
(-)sys/dev/hpt27xx/hpt27xx_osm_bsd.c (-4 lines)
Lines 1195-1204 Link Here
1195
1195
1196
		for (i=0; i<os_max_queue_comm; i++) {
1196
		for (i=0; i<os_max_queue_comm; i++) {
1197
			POS_CMDEXT ext = (POS_CMDEXT)malloc(sizeof(OS_CMDEXT), M_DEVBUF, M_WAITOK);
1197
			POS_CMDEXT ext = (POS_CMDEXT)malloc(sizeof(OS_CMDEXT), M_DEVBUF, M_WAITOK);
1198
			if (!ext) {
1199
				os_printk("Can't alloc cmdext(%d)", i);
1200
				return ;
1201
			}
1202
			ext->vbus_ext = vbus_ext;
1198
			ext->vbus_ext = vbus_ext;
1203
			ext->next = vbus_ext->cmdext_list;
1199
			ext->next = vbus_ext->cmdext_list;
1204
			vbus_ext->cmdext_list = ext;
1200
			vbus_ext->cmdext_list = ext;
(-)sys/dev/hptnr/hptnr_osm_bsd.c (-4 lines)
Lines 1386-1395 Link Here
1386
1386
1387
		for (i=0; i<os_max_queue_comm; i++) {
1387
		for (i=0; i<os_max_queue_comm; i++) {
1388
			POS_CMDEXT ext = (POS_CMDEXT)malloc(sizeof(OS_CMDEXT), M_DEVBUF, M_WAITOK);
1388
			POS_CMDEXT ext = (POS_CMDEXT)malloc(sizeof(OS_CMDEXT), M_DEVBUF, M_WAITOK);
1389
			if (!ext) {
1390
				os_printk("Can't alloc cmdext(%d)", i);
1391
				return ;
1392
			}
1393
			ext->vbus_ext = vbus_ext;
1389
			ext->vbus_ext = vbus_ext;
1394
			ext->next = vbus_ext->cmdext_list;
1390
			ext->next = vbus_ext->cmdext_list;
1395
			vbus_ext->cmdext_list = ext;
1391
			vbus_ext->cmdext_list = ext;
(-)sys/dev/hptrr/hptrr_osm_bsd.c (-4 lines)
Lines 1034-1043 Link Here
1034
1034
1035
		for (i=0; i<os_max_queue_comm; i++) {
1035
		for (i=0; i<os_max_queue_comm; i++) {
1036
			POS_CMDEXT ext = (POS_CMDEXT)malloc(sizeof(OS_CMDEXT), M_DEVBUF, M_WAITOK);
1036
			POS_CMDEXT ext = (POS_CMDEXT)malloc(sizeof(OS_CMDEXT), M_DEVBUF, M_WAITOK);
1037
			if (!ext) {
1038
				os_printk("Can't alloc cmdext(%d)", i);
1039
				return ;
1040
			}
1041
			ext->vbus_ext = vbus_ext;
1037
			ext->vbus_ext = vbus_ext;
1042
			ext->next = vbus_ext->cmdext_list;
1038
			ext->next = vbus_ext->cmdext_list;
1043
			vbus_ext->cmdext_list = ext;
1039
			vbus_ext->cmdext_list = ext;
(-)sys/dev/mfi/mfi.c (-5 / +3 lines)
Lines 3638-3648 Link Here
3638
		mfi_aen_entry = malloc(sizeof(struct mfi_aen), M_MFIBUF,
3638
		mfi_aen_entry = malloc(sizeof(struct mfi_aen), M_MFIBUF,
3639
		    M_WAITOK);
3639
		    M_WAITOK);
3640
		mtx_lock(&sc->mfi_io_lock);
3640
		mtx_lock(&sc->mfi_io_lock);
3641
		if (mfi_aen_entry != NULL) {
3641
		mfi_aen_entry->p = curproc;
3642
			mfi_aen_entry->p = curproc;
3642
		TAILQ_INSERT_TAIL(&sc->mfi_aen_pids, mfi_aen_entry,
3643
			TAILQ_INSERT_TAIL(&sc->mfi_aen_pids, mfi_aen_entry,
3643
		    aen_link);
3644
			    aen_link);
3645
		}
3646
		error = mfi_aen_register(sc, l_aen.laen_seq_num,
3644
		error = mfi_aen_register(sc, l_aen.laen_seq_num,
3647
		    l_aen.laen_class_locale);
3645
		    l_aen.laen_class_locale);
3648
3646
(-)sys/dev/sound/usb/uaudio.c (-23 / +19 lines)
Lines 3096-3126 Link Here
3096
	    malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK);
3096
	    malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK);
3097
	int ch;
3097
	int ch;
3098
3098
3099
	if (p_mc_new != NULL) {
3099
	memcpy(p_mc_new, mc, sizeof(*p_mc_new));
3100
		memcpy(p_mc_new, mc, sizeof(*p_mc_new));
3100
	p_mc_new->next = sc->sc_mixer_root;
3101
		p_mc_new->next = sc->sc_mixer_root;
3101
	sc->sc_mixer_root = p_mc_new;
3102
		sc->sc_mixer_root = p_mc_new;
3102
	sc->sc_mixer_count++;
3103
		sc->sc_mixer_count++;
3104
3103
3105
		/* set default value for all channels */
3104
	/* set default value for all channels */
3106
		for (ch = 0; ch < p_mc_new->nchan; ch++) {
3105
	for (ch = 0; ch < p_mc_new->nchan; ch++) {
3107
			switch (p_mc_new->val_default) {
3106
		switch (p_mc_new->val_default) {
3108
			case 1:
3107
		case 1:
3109
				/* 50% */
3108
			/* 50% */
3110
				p_mc_new->wData[ch] = (p_mc_new->maxval + p_mc_new->minval) / 2;
3109
			p_mc_new->wData[ch] = (p_mc_new->maxval + p_mc_new->minval) / 2;
3111
				break;
3110
			break;
3112
			case 2:
3111
		case 2:
3113
				/* 100% */
3112
			/* 100% */
3114
				p_mc_new->wData[ch] = p_mc_new->maxval;
3113
			p_mc_new->wData[ch] = p_mc_new->maxval;
3115
				break;
3114
			break;
3116
			default:
3115
		default:
3117
				/* 0% */
3116
			/* 0% */
3118
				p_mc_new->wData[ch] = p_mc_new->minval;
3117
			p_mc_new->wData[ch] = p_mc_new->minval;
3119
				break;
3118
			break;
3120
			}
3121
		}
3119
		}
3122
	} else {
3123
		DPRINTF("out of memory\n");
3124
	}
3120
	}
3125
}
3121
}
3126
3122
(-)sys/dev/twa/tw_osl_freebsd.c (-15 / +3 lines)
Lines 683-703 Link Here
683
	tw_osli_req_q_init(sc, TW_OSLI_FREE_Q);
683
	tw_osli_req_q_init(sc, TW_OSLI_FREE_Q);
684
	tw_osli_req_q_init(sc, TW_OSLI_BUSY_Q);
684
	tw_osli_req_q_init(sc, TW_OSLI_BUSY_Q);
685
685
686
	if ((sc->req_ctx_buf = (struct tw_osli_req_context *)
686
	sc->req_ctx_buf = (struct tw_osli_req_context *)
687
			malloc((sizeof(struct tw_osli_req_context) *
687
	    malloc((sizeof(struct tw_osli_req_context) * TW_OSLI_MAX_NUM_REQUESTS),
688
				TW_OSLI_MAX_NUM_REQUESTS),
688
	    TW_OSLI_MALLOC_CLASS, M_WAITOK | M_ZERO);
689
				TW_OSLI_MALLOC_CLASS, M_WAITOK)) == NULL) {
690
		tw_osli_printf(sc, "error = %d",
691
			TW_CL_SEVERITY_ERROR_STRING,
692
			TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER,
693
			0x2012,
694
			"Failed to allocate request packets",
695
			ENOMEM);
696
		return(ENOMEM);
697
	}
698
	bzero(sc->req_ctx_buf,
699
		sizeof(struct tw_osli_req_context) * TW_OSLI_MAX_NUM_REQUESTS);
700
701
	for (i = 0; i < TW_OSLI_MAX_NUM_REQUESTS; i++) {
689
	for (i = 0; i < TW_OSLI_MAX_NUM_REQUESTS; i++) {
702
		req = &(sc->req_ctx_buf[i]);
690
		req = &(sc->req_ctx_buf[i]);
703
		req->ctlr = sc;
691
		req->ctlr = sc;
(-)sys/dev/usb/usb_hub.c (-3 lines)
Lines 1371-1379 Link Here
1371
#if (USB_HAVE_FIXED_PORT == 0)
1371
#if (USB_HAVE_FIXED_PORT == 0)
1372
	hub = malloc(sizeof(hub[0]) + (sizeof(hub->ports[0]) * nports),
1372
	hub = malloc(sizeof(hub[0]) + (sizeof(hub->ports[0]) * nports),
1373
	    M_USBDEV, M_WAITOK | M_ZERO);
1373
	    M_USBDEV, M_WAITOK | M_ZERO);
1374
1375
	if (hub == NULL)
1376
		goto error;
1377
#else
1374
#else
1378
	hub = &sc->sc_hub;
1375
	hub = &sc->sc_hub;
1379
#endif
1376
#endif
(-)sys/fs/ext2fs/ext2_extents.c (-2 lines)
Lines 1500-1507 Link Here
1500
1500
1501
	path = malloc(sizeof(struct ext4_extent_path) * (depth + 1),
1501
	path = malloc(sizeof(struct ext4_extent_path) * (depth + 1),
1502
	    M_EXT2EXTENTS, M_WAITOK | M_ZERO);
1502
	    M_EXT2EXTENTS, M_WAITOK | M_ZERO);
1503
	if (!path)
1504
		return (ENOMEM);
1505
1503
1506
	path[0].ep_header = ehp;
1504
	path[0].ep_header = ehp;
1507
	path[0].ep_depth = depth;
1505
	path[0].ep_depth = depth;
(-)sys/fs/ext2fs/ext2_vnops.c (-4 lines)
Lines 1063-1072 Link Here
1063
			ext2_dec_nlink(dp);
1063
			ext2_dec_nlink(dp);
1064
			dp->i_flag |= IN_CHANGE;
1064
			dp->i_flag |= IN_CHANGE;
1065
			dirbuf = malloc(dp->i_e2fs->e2fs_bsize, M_TEMP, M_WAITOK | M_ZERO);
1065
			dirbuf = malloc(dp->i_e2fs->e2fs_bsize, M_TEMP, M_WAITOK | M_ZERO);
1066
			if (!dirbuf) {
1067
				error = ENOMEM;
1068
				goto bad;
1069
			}
1070
			error = vn_rdwr(UIO_READ, fvp, (caddr_t)dirbuf,
1066
			error = vn_rdwr(UIO_READ, fvp, (caddr_t)dirbuf,
1071
			    ip->i_e2fs->e2fs_bsize, (off_t)0,
1067
			    ip->i_e2fs->e2fs_bsize, (off_t)0,
1072
			    UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK,
1068
			    UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK,
(-)sys/net/if_vlan.c (-5 lines)
Lines 443-453 Link Here
443
		return;
443
		return;
444
444
445
	hash2 = malloc(sizeof(struct ifvlanhead) * n2, M_VLAN, M_WAITOK);
445
	hash2 = malloc(sizeof(struct ifvlanhead) * n2, M_VLAN, M_WAITOK);
446
	if (hash2 == NULL) {
447
		printf("%s: out of memory -- hash size not changed\n",
448
		    __func__);
449
		return;		/* We can live with the old hash table */
450
	}
451
	for (j = 0; j < n2; j++)
446
	for (j = 0; j < n2; j++)
452
		CK_SLIST_INIT(&hash2[j]);
447
		CK_SLIST_INIT(&hash2[j]);
453
	for (i = 0; i < n; i++)
448
	for (i = 0; i < n; i++)
(-)sys/netinet/ip_divert.c (-2 lines)
Lines 674-681 Link Here
674
		return error;
674
		return error;
675
675
676
	inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
676
	inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
677
	if (inp_list == NULL)
678
		return ENOMEM;
679
	
677
	
680
	INP_INFO_RLOCK_ET(&V_divcbinfo, et);
678
	INP_INFO_RLOCK_ET(&V_divcbinfo, et);
681
	for (inp = CK_LIST_FIRST(V_divcbinfo.ipi_listhead), i = 0; inp && i < n;
679
	for (inp = CK_LIST_FIRST(V_divcbinfo.ipi_listhead), i = 0; inp && i < n;
(-)sys/netinet/sctp_usrreq.c (-2 lines)
Lines 7312-7319 Link Here
7312
	 * Do the malloc first in case it blocks.
7312
	 * Do the malloc first in case it blocks.
7313
	 */
7313
	 */
7314
	SCTP_MALLOC_SONAME(sin, struct sockaddr_in *, sizeof *sin);
7314
	SCTP_MALLOC_SONAME(sin, struct sockaddr_in *, sizeof *sin);
7315
	if (sin == NULL)
7316
		return (ENOMEM);
7317
	sin->sin_family = AF_INET;
7315
	sin->sin_family = AF_INET;
7318
	sin->sin_len = sizeof(*sin);
7316
	sin->sin_len = sizeof(*sin);
7319
	inp = (struct sctp_inpcb *)so->so_pcb;
7317
	inp = (struct sctp_inpcb *)so->so_pcb;
(-)sys/netinet/udp_usrreq.c (-2 lines)
Lines 897-904 Link Here
897
		return (error);
897
		return (error);
898
898
899
	inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
899
	inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
900
	if (inp_list == NULL)
901
		return (ENOMEM);
902
900
903
	INP_INFO_RLOCK_ET(&V_udbinfo, et);
901
	INP_INFO_RLOCK_ET(&V_udbinfo, et);
904
	for (inp = CK_LIST_FIRST(V_udbinfo.ipi_listhead), i = 0; inp && i < n;
902
	for (inp = CK_LIST_FIRST(V_udbinfo.ipi_listhead), i = 0; inp && i < n;
(-)sys/netpfil/ipfw/ip_dummynet.c (-8 lines)
Lines 1348-1357 Link Here
1348
		return err;
1348
		return err;
1349
	}
1349
	}
1350
	ep = malloc(l, M_DUMMYNET, M_WAITOK);
1350
	ep = malloc(l, M_DUMMYNET, M_WAITOK);
1351
	if(!ep) {
1352
		err = ENOMEM ;
1353
		return err;
1354
	}
1355
	do {
1351
	do {
1356
		err = sooptcopyin(sopt, ep, l, l);
1352
		err = sooptcopyin(sopt, ep, l, l);
1357
		if(err)
1353
		if(err)
Lines 1403-1412 Link Here
1403
		return err;
1399
		return err;
1404
	}
1400
	}
1405
	ep = malloc(l, M_DUMMYNET, M_WAITOK);
1401
	ep = malloc(l, M_DUMMYNET, M_WAITOK);
1406
	if(!ep) {
1407
		err = ENOMEM ;
1408
		return err;
1409
	}
1410
	do {
1402
	do {
1411
		err = sooptcopyin(sopt, ep, l, l);
1403
		err = sooptcopyin(sopt, ep, l, l);
1412
		if(err)
1404
		if(err)
(-)sys/netsmb/smb_rq.c (-4 lines)
Lines 67-74 Link Here
67
	int error;
67
	int error;
68
68
69
	rqp = malloc(sizeof(*rqp), M_SMBRQ, M_WAITOK);
69
	rqp = malloc(sizeof(*rqp), M_SMBRQ, M_WAITOK);
70
	if (rqp == NULL)
71
		return ENOMEM;
72
	error = smb_rq_init(rqp, layer, cmd, scred);
70
	error = smb_rq_init(rqp, layer, cmd, scred);
73
	rqp->sr_flags |= SMBR_ALLOCED;
71
	rqp->sr_flags |= SMBR_ALLOCED;
74
	if (error) {
72
	if (error) {
Lines 380-387 Link Here
380
	int error;
378
	int error;
381
379
382
	t2p = malloc(sizeof(*t2p), M_SMBRQ, M_WAITOK);
380
	t2p = malloc(sizeof(*t2p), M_SMBRQ, M_WAITOK);
383
	if (t2p == NULL)
384
		return ENOMEM;
385
	error = smb_t2_init(t2p, layer, setup, scred);
381
	error = smb_t2_init(t2p, layer, setup, scred);
386
	t2p->t2_flags |= SMBT2_ALLOCED;
382
	t2p->t2_flags |= SMBT2_ALLOCED;
387
	if (error) {
383
	if (error) {

Return to bug 240545