From: Sanath Kumar Date: Tue, 4 Apr 2017 05:14:42 +0000 (-0500) Subject: sparc64: dax_overflow_check reports incorrect data X-Git-Tag: v4.1.12-98.0.20170517_2143~33^2~12 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3577f103983d53ed6b7b44e3d199582273946c71;p=users%2Fjedix%2Flinux-maple.git sparc64: dax_overflow_check reports incorrect data Orabug: 25820395 The range reported for a page overflow is incorrect when the address is page_size aligned. Add 1 to the address so that it always reports the next page_size boundary. Reviewed-by: Rob Gardner Signed-off-by: Sanath Kumar Signed-off-by: Allen Pais --- diff --git a/arch/sparc/dax/dax_misc.c b/arch/sparc/dax/dax_misc.c index 878c88f9bd21d..89b38988f092c 100644 --- a/arch/sparc/dax/dax_misc.c +++ b/arch/sparc/dax/dax_misc.c @@ -216,13 +216,13 @@ void dax_overflow_check(struct dax_ctx *ctx, int idx) dax_dbg("* Output address = 0x%lx, page size = 0x%lx; page overflow %s", virtp, page_size, - (virtp + ca->output_sz >= ALIGN(virtp, page_size)) ? + (virtp + ca->output_sz >= ALIGN(virtp + 1, page_size)) ? "LIKELY" : "UNLIKELY"); dax_dbg("* Output size produced (0x%x) is %s the page bounds 0x%lx..0x%lx", ca->output_sz, - (virtp + ca->output_sz >= ALIGN(virtp, page_size)) ? + (virtp + ca->output_sz >= ALIGN(virtp + 1, page_size)) ? "OUTSIDE" : "WITHIN", - virtp, ALIGN(virtp, page_size)); + virtp, ALIGN(virtp + 1, page_size)); } virtp = ccb->dwords[QUERY_DWORD_INPUT]; @@ -247,14 +247,14 @@ void dax_overflow_check(struct dax_ctx *ctx, int idx) dax_dbg("* Input address = 0x%lx, page size = 0x%lx; page overflow %s", virtp, page_size, (virtp + input_size >= - ALIGN(virtp, page_size)) ? + ALIGN(virtp + 1, page_size)) ? "LIKELY" : "UNLIKELY"); dax_dbg("* Input size processed (0x%x) is %s the page bounds 0x%lx..0x%lx", ca->n_processed, (virtp + ca->n_processed >= - ALIGN(virtp, page_size)) ? + ALIGN(virtp + 1, page_size)) ? "OUTSIDE" : "WITHIN", - virtp, ALIGN(virtp, page_size)); + virtp, ALIGN(virtp + 1, page_size)); } dax_dbg("*************************"); }