Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Mar 2022 07:15:42 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Hans Petter Selasky <hps@selasky.org>
Cc:        Mateusz Piotrowski <0mp@freebsd.org>, src-committers <src-committers@freebsd.org>,  "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>, dev-commits-src-main@freebsd.org
Subject:   Re: git: 419822b372f5 - main - libgeom(3): Use calloc instead of malloc and bzero.
Message-ID:  <CANCZdfrm4n9ML==p_Uwb0PAneY6jgUc8gA_hDgoommmCB=8C3g@mail.gmail.com>
In-Reply-To: <a55f8a81-7897-6f6d-68fe-de41a733dce2@selasky.org>
References:  <202203110942.22B9guNt032463@gitrepo.freebsd.org> <4eaba9f4-7cd6-5af3-d745-97932501a2fc@FreeBSD.org> <a55f8a81-7897-6f6d-68fe-de41a733dce2@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000f0366d05d9f1f7ad
Content-Type: text/plain; charset="UTF-8"

On Fri, Mar 11, 2022, 4:10 AM Hans Petter Selasky <hps@selasky.org> wrote:

> On 3/11/22 11:57, Mateusz Piotrowski wrote:
> > Hi,
> >
> > I grepped out tree and there are many other places, which could be
> > converted to using calloc. Is there anything to watch out for when
> > converting malloc and memset call pairs to calloc?
> >
>
> Hi,
>
> If you have a tool for it combined with a review, should be pretty
> straight forward.
>

You likely can use coccinelle to find these. It works better than grep.

I don't see any issues converting malloc, memset/bzero sequences, as
> long as they zero the full memory area allocated.
>

I'd break the commits up one per directory in case one needs to be
reverted...

Maybe in contributed code, you need to push changes upstream first.
>

Definitely.

Warner

> --HPS
>

>

--000000000000f0366d05d9f1f7ad
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div><br><br><div class=3D"gmail_quote"><div dir=3D"ltr" =
class=3D"gmail_attr">On Fri, Mar 11, 2022, 4:10 AM Hans Petter Selasky &lt;=
<a href=3D"mailto:hps@selasky.org">hps@selasky.org</a>&gt; wrote:<br></div>=
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">On 3/11/22 11:57, Mateusz Piotrowski wrote:<=
br>
&gt; Hi,<br>
&gt; <br>
&gt; I grepped out tree and there are many other places, which could be <br=
>
&gt; converted to using calloc. Is there anything to watch out for when <br=
>
&gt; converting malloc and memset call pairs to calloc?<br>
&gt; <br>
<br>
Hi,<br>
<br>
If you have a tool for it combined with a review, should be pretty <br>
straight forward.<br></blockquote></div></div><div dir=3D"auto"><br></div><=
div dir=3D"auto">You likely can use coccinelle to find these. It works bett=
er than grep.</div><div dir=3D"auto"><br></div><div dir=3D"auto"><div class=
=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8=
ex;border-left:1px #ccc solid;padding-left:1ex">
I don&#39;t see any issues converting malloc, memset/bzero sequences, as <b=
r>
long as they zero the full memory area allocated.<br></blockquote></div></d=
iv><div dir=3D"auto"><br></div><div dir=3D"auto">I&#39;d break the commits =
up one per directory in case one needs to be reverted...</div><div dir=3D"a=
uto"><br></div><div dir=3D"auto"><div class=3D"gmail_quote"><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pa=
dding-left:1ex">
Maybe in contributed code, you need to push changes upstream first.<br></bl=
ockquote></div></div><div dir=3D"auto"><br></div><div dir=3D"auto">Definite=
ly.=C2=A0</div><div dir=3D"auto"><br></div><div dir=3D"auto">Warner=C2=A0</=
div><div dir=3D"auto"><div class=3D"gmail_quote"><blockquote class=3D"gmail=
_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:=
1ex">
--HPS<br>
</blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><br></blockquote></div></div></=
div>

--000000000000f0366d05d9f1f7ad--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfrm4n9ML==p_Uwb0PAneY6jgUc8gA_hDgoommmCB=8C3g>