Re: [RFC PATCH 06/35] rbd: Use ceph_databuf for rbd_obj_read_sync()

David Howells
2025-04-11T13:48:37Z

Viacheslav Dubeyko <Slava.Dubeyko@ibm.com> wrote:

> > + dbuf = ceph_databuf_req_alloc(1, sizeof(*ondisk), GFP_KERNEL);
>
> I am slightly worried about such using of ondisk variable. We have garbage as a
> value of ondisk pointer on this step yet. And pointer dereferencing could look
> confusing here. Also, potentially, compiler and static analysis tools could
> complain. I don't see a problem here but anyway I am feeling worried. :)

It's a sizeof() construction. We do this all the time:

struct fred *p;

p = kmalloc(sizeof(*p), GFP_KERNEL);

David