]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
dm ioctl: use offsetof() instead of open-coding it
authorBart Van Assche <bart.vanassche@sandisk.com>
Fri, 18 Nov 2016 22:28:00 +0000 (14:28 -0800)
committerMike Snitzer <snitzer@redhat.com>
Thu, 8 Dec 2016 19:13:08 +0000 (14:13 -0500)
commit6080758d441acd7765314f3e9b6ca843e18e9a68
treeed5a796823ccb7e039b209d7e88a550d3fd74e8f
parentb23df0d048e5f137ad5c2a116ec0849a98d43b96
dm ioctl: use offsetof() instead of open-coding it

Subtracting sizes is a fragile approach because the result is only
correct if the compiler has not added any padding at the end of the
structure. Hence use offsetof() instead of size subtraction. An
additional advantage of offsetof() is that it makes the intent more
clear.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-ioctl.c