From 76b4a69aab7cbfb4a087194b6d6ee182c1d5dd7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= Date: Thu, 2 Feb 2012 14:53:43 -0500 Subject: [PATCH] Using sizeof() on a function parameter with an array type does not work. sizeof() treats such parameters as pointers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ville Syrjälä --- xf86drmMode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xf86drmMode.c b/xf86drmMode.c index 473e7341..c809c44a 100644 --- a/xf86drmMode.c +++ b/xf86drmMode.c @@ -271,9 +271,9 @@ int drmModeAddFB2(int fd, uint32_t width, uint32_t height, f.height = height; f.pixel_format = pixel_format; f.flags = flags; - memcpy(f.handles, bo_handles, sizeof(bo_handles)); - memcpy(f.pitches, pitches, sizeof(pitches)); - memcpy(f.offsets, offsets, sizeof(offsets)); + memcpy(f.handles, bo_handles, 4 * sizeof(bo_handles[0])); + memcpy(f.pitches, pitches, 4 * sizeof(pitches[0])); + memcpy(f.offsets, offsets, 4 * sizeof(offsets[0])); if ((ret = DRM_IOCTL(fd, DRM_IOCTL_MODE_ADDFB2, &f))) return ret;