Skip to content

staging: lustre: remove uses and definition of container_of0

Dilger lustre-devel 1 version New

Get series with b4
b4 am D242E3F1.110E68%[email protected]

Versions newest first

  1. v1 Latest0 of 7 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 7 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [lustre-devel] [PATCH 0/7] staging: lustre: remove uses and definition of container_of0
Quoted 5 lines · Aya Mahfouz

container_of0 can be replaced by the Linux kernel macro container_of. The only difference is that container_of0 tries to evade type casting when the pointer is erroneous or null. All uses of container_of0 have been replaced by container_of and then the macro was removed in the last patch.

Thank you for your patch. However, it should be noted that this blanket replacement of container_of0() isn't necessarily safe. If the caller isn't explicitly checking for IS_ERR(ptr) or ptr == NULL then the container_of() macro can transform the err/NULL pointer into another pointer that is NOT err/NULL and cause the kernel to oops when the bad pointer is used, even if there are later IS_ERR() or NULL checks.

I'm not against removing container_of0() completely, but not without a clear review of the callers to determine whether err/NULL pointers are not actually possible in this callpath, or explicit checks in the callers for err/NULL pointers before container_of() is used. Did you do that?

Cheers, Andreas

Quoted 9 lines

Aya Mahfouz (7):
staging: lustre: lcommon_cl.c: replace container_of0 by container_of
staging: lustre: llite_nfs.c: replace container_of0 by container_of
staging: lustre: lu_object.c: replace container_of0 by container_of
staging: lustre: echo_client.c: replace container_of0 by container_of
staging: lustre: osc_io.c: replace container_of0 by container_of
staging: lustre: osc_object.c: replace container_of0 by container_of
staging: lustre: remove container_of0 and __container_of

Quoted 17 lines
drivers/staging/lustre/include/linux/libcfs/libcfs.h | 11 -----------
drivers/staging/lustre/lustre/lclient/lcommon_cl.c   | 10 +++++-----
drivers/staging/lustre/lustre/llite/llite_nfs.c      |  2 +-
drivers/staging/lustre/lustre/obdclass/lu_object.c   |  6 +++---
drivers/staging/lustre/lustre/obdecho/echo_client.c  |  2 +-
drivers/staging/lustre/lustre/osc/osc_io.c           |  4 ++--
drivers/staging/lustre/lustre/osc/osc_object.c       |  2 +-
7 files changed, 13 insertions(+), 24 deletions(-)
Signature · 6 lines
2.4.2


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz

Cheers, Andreas

Signature · 4 lines
Andreas Dilger

Lustre Software Architect
Intel High Performance Data Division