[Devel] [PATCH RHEL7 COMMIT] ploop: Check queue_flags size at compile time

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jan 18 16:22:51 MSK 2023


The commit is pushed to "branch-rh7-3.10.0-1160.80.1.vz7.192.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.80.1.vz7.192.2
------>
commit 27a5275ea7e9fd28bca4df13d5ffc846b2a0568b
Author: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
Date:   Thu Jan 5 18:50:09 2023 +0200

    ploop: Check queue_flags size at compile time
    
    QUEUE_STANDBY_EN flag made the used bits more than 31 so it is now
    required that queue_flags is a 64 bits. Add compile time check to
    ensure it is.
    
    https://jira.sw.ru/browse/PSBM-144163
    Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
 drivers/block/ploop/dev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 32f4a394e4b8..4e06123f4f14 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -3623,6 +3623,9 @@ static int ploop_replace_delta(struct ploop_device * plo, unsigned long arg)
 	spin_lock_irq(plo->queue->queue_lock);
 	queue_flag_clear(QUEUE_FLAG_STANDBY, plo->queue);
 	spin_unlock_irq(plo->queue->queue_lock);
+	BUILD_BUG_ON_MSG(sizeof(plo->queue->queue_flags) * 8 < BITS_PER_LONG ||
+					 BITS_PER_LONG < 64,
+			"queue_flags require 64 bit storage variable");
 
 	ploop_relax(plo);
 


More information about the Devel mailing list