Appropriate NULL pointer checking to avoid mysterious panic during
device cloning. Approved by: netchild (mentor)
This commit is contained in:
parent
fe35a11a2b
commit
8be20fbe2a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152005
@ -1157,7 +1157,7 @@ dsp_clone(void *arg, struct ucred *cred, char *name, int namelen,
|
||||
panic("Unknown devtype %d", devtype);
|
||||
}
|
||||
|
||||
if ((pdev->si_drv1 == NULL) && (pdev->si_drv2 == NULL)) {
|
||||
if ((pdev != NULL) && (pdev->si_drv1 == NULL) && (pdev->si_drv2 == NULL)) {
|
||||
*dev = pdev;
|
||||
dev_ref(*dev);
|
||||
return;
|
||||
|
@ -515,7 +515,7 @@ mixer_clone(void *arg, struct ucred *cred, char *name, int namelen,
|
||||
return;
|
||||
if (strcmp(name, "mixer") == 0) {
|
||||
sd = devclass_get_softc(pcm_devclass, snd_unit);
|
||||
if (sd != NULL) {
|
||||
if (sd != NULL && sd->mixer_dev != NULL) {
|
||||
*dev = sd->mixer_dev;
|
||||
dev_ref(*dev);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user