Patch "media: venus: helpers: Fix ALIGN() of non power of two" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    media: venus: helpers: Fix ALIGN() of non power of two

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     media-venus-helpers-fix-align-of-non-power-of-two.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b097b170b34945fffdfba39be6f1987ca89a12d7
Author: Rikard Falkeborn <rikard.falkeborn@xxxxxxxxx>
Date:   Sat Sep 12 20:03:01 2020 +0100

    media: venus: helpers: Fix ALIGN() of non power of two
    
    [ Upstream commit 927e78ac8bc58155316cf6f46026e1912bbbbcfc ]
    
    ALIGN() expects its second argument to be a power of 2, otherwise
    incorrect results are produced for some inputs. The output can be
    both larger or smaller than what is expected.
    
    For example, ALIGN(304, 192) equals 320 instead of 384, and
    ALIGN(65, 192) equals 256 instead of 192.
    
    However, nestling two ALIGN() as is done in this case seem to only
    produce results equal to or bigger than the expected result if ALIGN()
    had handled non powers of two, and that in turn results in framesizes
    that are either the correct size or too large.
    
    Fortunately, since 192 * 4 / 3 equals 256, it turns out that one ALIGN()
    is sufficient.
    
    Fixes: ab1eda449c6e ("media: venus: vdec: handle 10bit bitstreams")
    Signed-off-by: Rikard Falkeborn <rikard.falkeborn@xxxxxxxxx>
    Signed-off-by: Stanimir Varbanov <stanimir.k.varbanov@xxxxxxxxx>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
index 8012f5c7bf344..ff705d513aae4 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -981,8 +981,8 @@ static u32 get_framesize_raw_yuv420_tp10_ubwc(u32 width, u32 height)
 	u32 extradata = SZ_16K;
 	u32 size;
 
-	y_stride = ALIGN(ALIGN(width, 192) * 4 / 3, 256);
-	uv_stride = ALIGN(ALIGN(width, 192) * 4 / 3, 256);
+	y_stride = ALIGN(width * 4 / 3, 256);
+	uv_stride = ALIGN(width * 4 / 3, 256);
 	y_sclines = ALIGN(height, 16);
 	uv_sclines = ALIGN((height + 1) >> 1, 16);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux