Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: qat - don't cast parameter in bit operations

While in this particular case it would not be a (critical) issue,
the pattern itself is bad and error prone in case the location
of the parameter is changed.

Don't cast parameter to unsigned long pointer in the bit operations.
Instead copy to a local variable on stack of a proper type and use.

Fixes: b4b7e67c917f ("crypto: qat - Intel(R) QAT ucode part of fw loader")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Andy Shevchenko and committed by
Herbert Xu
fffe799b 4ba31cdd

+6 -3
+6 -3
drivers/crypto/qat/qat_common/qat_uclo.c
··· 387 387 page = image->page; 388 388 389 389 for_each_set_bit(ae, &ae_mask, handle->hal_handle->ae_max_num) { 390 - if (!test_bit(ae, (unsigned long *)&uof_image->ae_assigned)) 390 + unsigned long ae_assigned = uof_image->ae_assigned; 391 + 392 + if (!test_bit(ae, &ae_assigned)) 391 393 continue; 392 394 393 395 if (!test_bit(ae, &cfg_ae_mask)) ··· 666 664 continue; 667 665 668 666 for (i = 0; i < obj_handle->uimage_num; i++) { 669 - if (!test_bit(ae, (unsigned long *) 670 - &obj_handle->ae_uimage[i].img_ptr->ae_assigned)) 667 + unsigned long ae_assigned = obj_handle->ae_uimage[i].img_ptr->ae_assigned; 668 + 669 + if (!test_bit(ae, &ae_assigned)) 671 670 continue; 672 671 mflag = 1; 673 672 if (qat_uclo_init_ae_data(obj_handle, ae, i))