On 01/12/23 10:28:52, Linus Walleij wrote: > Hi Jorge, > > thanks for your patch! > > On Fri, Dec 1, 2023 at 10:10 AM Jorge Ramirez-Ortiz <jorge@xxxxxxxxxxxx> wrote: > > > When RPMB was converted to a character device, it added support for > > multiple RPMB partitions (Commit 97548575bef3 ("mmc: block: Convert RPMB > > to a character device"). > > > > One of the changes in this commit was transforming the variable > > target_part defined in __mmc_blk_ioctl_cmd into a bitmask. > > > > This inadvertedly regressed the validation check done in > > mmc_blk_part_switch_pre() and mmc_blk_part_switch_post(). > > > > This commit fixes that regression. > > > > Fixes: 97548575bef3 ("mmc: block: Convert RPMB to a character device") > > Signed-off-by: Jorge Ramirez-Ortiz <jorge@xxxxxxxxxxxx> > > My bug :/ > Shouldn't we also add Cc: stable@xxxxxxxxxxxxxxx? ack, will do. > > > > + const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB; > > int ret = 0; > > > > - if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) { > > + if (part_type & mask == mask) { > > That looks complex, can't we just: > > if (part_type & EXT_CSD_PART_CONFIG_ACC_RPMB)? I chose to mention the mask nature of the field for clarity - just in case - but I'd much rather do your suggestion. So will do :) > > > + const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB; > > int ret = 0; > > > > - if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) { > > + if (part_type & mask == mask) { > > Dito here. yep > > Yours, > Linus Walleij thanks !