Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 06 Oct 2019 18:36:44 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 240545] patch to remove unneeded M_WAITOK return value checks
Message-ID:  <bug-240545-227-FJzMOSVcFi@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-240545-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-240545-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D240545

--- Comment #8 from Conrad Meyer <cem@freebsd.org> ---
There's some way of declaring that a coccinelle variable ('buf') hasn't been
reassigned since the earlier malloc call, although I don't recall how to do=
 it.
 E.g., in this code,

  buf =3D malloc(M_WAITOK);
  ...
  buf =3D malloc(M_NOWAIT);
  if (buf =3D=3D NULL) {
    /* this case shouldn't be removed */
  }

The null check shouldn't be removed.

It's a weird and probably bad pattern to reuse the same C variable for
allocation with a different policy in the same function, but possible.

> Still need to look through / basic test the generated patch, but wanted t=
o share the Coccinelle spatch.

Thanks!

> It took a long time (at least 12 hours) to run on the src/sys tree.

Yeah, it's not fast.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-240545-227-FJzMOSVcFi>