drivers/gpu/drm/drm_crtc.c:4472 drm_mode_crtc_set_gamma_size() warn: double check that we're allocating correct size: 2 vs 6
A message that is not in the archive (sent off-list or not yet received): 20141210140306.GC32722@mwanda
A message that is not in the archive (sent off-list or not yet received): CAKMK7uHNeM9ebkpWKi30zz73-xferz39WQMvh6G4SrKAJyFxjw@mail.gmail.com
Forgotten to add mailing lists.
-Daniel
Quoted 25 lines · Daniel Vetter
Quoted 10 lines · Dan Carpenter
From a style prespective this should be:
crtc->gamma_store = kcalloc(gamma_size * 3, sizeof(uint16_t), GFP_KERNEL);Because the elements are
sizeof(uint16_t), we are allocating 3 arrays ofgamma_sizeelements. But I guess it's nice to move all the constants to one side of the equation so that it tests for integer overflows... Whatever you decided is fine, this is a one time email that is auto-genenerated.Imo the point of kcalloc and
kmalloc_arrayis to get the overflow checks correct. Putting the *3 to thegamma_size(which can be fairly big and migth come from dubios places) means we still have to deal with overflow headaches. sizeof(uint16_t)*3 is trivial to see that it's not overflowing.I think your style guide here is exactly _not_ what we should do as best practice for safe code.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel