* linux-4.4-rc8/drivers/media/platform/s5p-tv/mixer_video.c:270: possible int/long mixup ?
@ 2016-01-04 17:51 David Binderman
0 siblings, 0 replies; only message in thread
From: David Binderman @ 2016-01-04 17:51 UTC (permalink / raw)
To: linux-arm-kernel
Hello there,
[linux-4.4-rc8/drivers/media/platform/s5p-tv/mixer_video.c:270]: (style) int result is returned as long value. If the return value is long to avoid loss of information, then you have loss of information.
Source code is
unsigned long mxr_get_plane_size(const struct mxr_block *blk,
??? unsigned int width, unsigned int height)
{
??? unsigned int bl_width = divup(width, blk->width);
??? unsigned int bl_height = divup(height, blk->height);
??? return bl_width * bl_height * blk->size;
}
Suggest new code
unsigned long mxr_get_plane_size(const struct mxr_block *blk,
??? unsigned int width, unsigned int height)
{
??? unsigned int bl_width = divup(width, blk->width);
??? unsigned int bl_height = divup(height, blk->height);
??? return bl_width * bl_height * (unsigned long) blk->size;
}
Addition of the cast causes both multiplies to be in unsigned long
type, not unsigned int, thus preserving values.
Regards
David Binderman
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-01-04 17:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-04 17:51 linux-4.4-rc8/drivers/media/platform/s5p-tv/mixer_video.c:270: possible int/long mixup ? David Binderman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.