On Sat, Sep 19, 2026 at 05:57:36PM +0100, Lorenzo Stoakes (ARM) wrote:
> On Thu, Sep 17, 2026 at 11:42:50AM -0700, Kees Cook wrote:
> > > [...]
> > > +static const struct dep *lookup_dep(const char *path)
> > > +{
> > > + const unsigned int key = hash_str(path);
> > > + struct dep *dep;
> > > + struct stat st;
> > > +
> > > + hash_for_each_possible(dep_table, dep, hnode, key) {
> > > + if (!strcmp(dep->path, path))
> > > + return dep;
> > > + }
> > > +
> > > + dep = xmalloc(sizeof(*dep) + strlen(path) + 1);
> > > + strcpy(dep->path, path);
> > > + dep->exists = !stat(path, &st);
> > > + if (dep->exists)
> > > + dep->mtime = st.st_mtim;
> >
> > I realize you only check "mtime" after an "exists" check, but I bristle
> > at leaving a time-stamp uninitialized. Can we just add an "else
> > dep->mtime = 0" here?
>
> Ack, done for v4!
Actually I think it's nicer to just make this xmalloc() an xcalloc() here,
dep->mtime is a struct timespec and setting that to zero gets ugly :)
>
> >
> > -Kees
> >
> > --
> > Kees Cook
>
> --
> Cheers, Lorenzo
--
Cheers, Lorenzo