tmio_mmc: fix misuse of kunmap_atomic() in tmio_mmc.c
Subsystems (2)
PATCH 1/1 tmio_mmc: fix misuse of kunmap_atomic() in tmio_mmc.c
According to commit 597781f3e51f48ef8e67be772196d9e9673752c4
kmap_atomic: make kunmap_atomic() harder to misuse
kunmap_atomic() takes a pointer to within the page, instead of a pointer to 'struct page'. So tmio_mmc_kunmap_atomic() should really take the pointer what tmio_mmc_kmap_atomic() returns.
--- drivers/mmc/host/tmio_mmc.c | 2 +- drivers/mmc/host/tmio_mmc.h | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/mmc/host/tmio_mmc.c +1 -1
@@ -191,7 +191,7 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host) host->sg_off += count; -tmio_mmc_kunmap_atomic (host, &flags); +tmio_mmc_kunmap_atomic (buf, &flags);if (host->sg_off == host->sg_ptr->length)tmio_mmc_next_sg (host);
drivers/mmc/host/tmio_mmc.h +2 -3
@@ -186,10 +186,9 @@ static inline char *tmio_mmc_kmap_atomic(struct tmio_mmc_host *host,return kmap_atomic (sg_page (sg),KM_BIO_SRC_IRQ ) + sg->offset; } -static inline void tmio_mmc_kunmap_atomic (struct tmio_mmc_host *host, -unsigned long *flags) +static inline void tmio_mmc_kunmap_atomic (void *buf,unsigned long *flags) { -kunmap_atomic (sg_page (host->sg_ptr),KM_BIO_SRC_IRQ ); +kunmap_atomic (buf,KM_BIO_SRC_IRQ );local_irq_restore (*flags); }
Signature · 1 line
1.7.0.4
PATCH 1/1 tmio_mmc: fix misuse of kunmap_atomic() in tmio_mmc.c
Hi Eric
Quoted 7 lines · Eric Miao
According to commit
597781f3e51f48ef8e67be772196d9e9673752c4
kmap_atomic: makekunmap_atomic()harder to misuse
kunmap_atomic()takes a pointer to within the page, instead of a pointer to 'struct page'. Sotmio_mmc_kunmap_atomic()should really take the pointer whattmio_mmc_kmap_atomic()returns.
As you have seen, I've also prepared a fix for this problem, just haven't sent it fast enough;) And, I think, your fix isn't quite correct: "buf" is not the returned value from tmio_mmc_kmap_atomic(), so, you cannot use it for unmapping.
Thanks
Guennadi
Quoted 48 lines
Cc Ian Molton <[email protected]>Cc Magnus Damm <[email protected]>Signed-off-by Eric Miao <[email protected]>--- drivers/mmc/host/tmio_mmc.c | 2 +- drivers/mmc/host/tmio_mmc.h | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-)drivers/mmc/host/tmio_mmc.c +1
-1@@ -191,7 +191,7 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host) host->sg_off += count; -tmio_mmc_kunmap_atomic (host, &flags); +tmio_mmc_kunmap_atomic (buf, &flags);if (host->sg_off == host->sg_ptr->length)tmio_mmc_next_sg (host);drivers/mmc/host/tmio_mmc.h +2
-3@@ -186,10 +186,9 @@ static inline char *tmio_mmc_kmap_atomic(struct tmio_mmc_host *host,return kmap_atomic (sg_page (sg),KM_BIO_SRC_IRQ ) + sg->offset; } -static inline void tmio_mmc_kunmap_atomic (struct tmio_mmc_host *host, -unsigned long *flags) +static inline void tmio_mmc_kunmap_atomic (void *buf,unsigned long *flags) { -kunmap_atomic (sg_page (host->sg_ptr),KM_BIO_SRC_IRQ ); +kunmap_atomic (buf,KM_BIO_SRC_IRQ );local_irq_restore (*flags); }Signature · 7 lines
1.7.0.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
PATCH 1/1 tmio_mmc: fix misuse of kunmap_atomic() in tmio_mmc.c
Quoted 8 lines · Guennadi Liakhovetski
Hi Eric
Quoted 4 lines · Eric Miao
According to commit
597781f3e51f48ef8e67be772196d9e9673752c4? ?
kmap_atomic: makekunmap_atomic()harder to misuse
Quoted 9 lines
Quoted 3 lines
kunmap_atomic()takes a pointer to within the page, instead of a pointer to 'struct page'. ?Sotmio_mmc_kunmap_atomic()should really take the pointer whattmio_mmc_kmap_atomic()returns.As you have seen, I've also prepared a fix for this problem, just haven't sent it fast enough;) And, I think, your fix isn't quite correct: "buf" is not the returned value from
tmio_mmc_kmap_atomic(), so, you cannot use it for unmapping.
Nah, just trying to fix my build here, didn't look into that too much. Your patch is of course welcome ;-)
Quoted 57 lines
Thanks
GuennadiQuoted 43 lines
Cc Ian Molton <[email protected]>Cc Magnus Damm <[email protected]>Signed-off-by Eric Miao <[email protected]>---
?drivers/mmc/host/tmio_mmc.c | ? ?2 +-
?drivers/mmc/host/tmio_mmc.h | ? ?5 ++---
?2 files changed, 3 insertions(+), 4 deletions(-)drivers/mmc/host/tmio_mmc.c +1
-1@@ -191,7 +191,7 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host) ? ? ? host->sg_off += count; - ? ? tmio_mmc_kunmap_atomic(host, &flags); + ? ? tmio_mmc_kunmap_atomic(buf, &flags); ? ? ? if (host->sg_off == host->sg_ptr->length) ? ? ? ? ? ? ? tmio_mmc_next_sg(host);drivers/mmc/host/tmio_mmc.h +2
-4@@ -186,10 +186,9 @@ static inline char *tmio_mmc_kmap_atomic(struct tmio_mmc_host *host, ? ? ? return kmap_atomic(sg_page(sg), KM_BIO_SRC_IRQ) + sg->offset; ?} -static inline void tmio_mmc_kunmap_atomic (struct tmio_mmc_host *host, - ? ? unsigned long *flags) +static inline void tmio_mmc_kunmap_atomic (void *buf,unsigned long *flags) ?{ - ? ? kunmap_atomic(sg_page(host->sg_ptr), KM_BIO_SRC_IRQ); + ? ? kunmap_atomic(buf, KM_BIO_SRC_IRQ); ? ? ? local_irq_restore(*flags); ?} --1.7.0.4
Quoted 5 lines
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/