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

From: David Howells
Date: Fri Apr 11 2025 - 09:54:54 EST


Viacheslav Dubeyko <Slava.Dubeyko@xxxxxxx> 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