git: 285d85f4f96b - main - arcmsr(4): Fix reading buffer empty length error.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 01 Apr 2023 05:54:44 UTC
The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=285d85f4f96bf3b5aecccad865a8855724241c32 commit 285d85f4f96bf3b5aecccad865a8855724241c32 Author: 黃清隆 <ching2048@areca.com.tw> AuthorDate: 2023-04-01 05:43:43 +0000 Commit: Xin LI <delphij@FreeBSD.org> CommitDate: 2023-04-01 05:43:43 +0000 arcmsr(4): Fix reading buffer empty length error. MFC after: 2 weeks --- sys/dev/arcmsr/arcmsr.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/dev/arcmsr/arcmsr.c b/sys/dev/arcmsr/arcmsr.c index dcb940bf339c..ac56c072cd38 100644 --- a/sys/dev/arcmsr/arcmsr.c +++ b/sys/dev/arcmsr/arcmsr.c @@ -87,6 +87,7 @@ ** scatter-gather count large than some number ** 1.50.00.03 05/04/2021 Ching Huang Fixed doorbell status arrived late on ARC-1886 ** 1.50.00.04 12/08/2021 Ching Huang Fixed boot up hung under ARC-1886 with no volume created +** 1.50.00.05 03/23/2023 Ching Huang Fixed reading buffer empty length error ****************************************************************************************** */ @@ -144,7 +145,7 @@ __FBSDID("$FreeBSD$"); #define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1); -#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.04 2021-12-08" +#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.05 2023-03-23" #include <dev/arcmsr/arcmsr.h> /* ************************************************************************** @@ -1555,8 +1556,10 @@ static void arcmsr_iop2drv_data_wrote_handle(struct AdapterControlBlock *acb) /*check this iop data if overflow my rqbuffer*/ ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock); prbuffer = arcmsr_get_iop_rqbuffer(acb); - my_empty_len = (acb->rqbuf_lastindex - acb->rqbuf_firstindex - 1) & - (ARCMSR_MAX_QBUFFER-1); + if (acb->rqbuf_lastindex >= acb->rqbuf_firstindex) + my_empty_len = (ARCMSR_MAX_QBUFFER - 1) - (acb->rqbuf_lastindex - acb->rqbuf_firstindex); + else + my_empty_len = acb->rqbuf_firstindex - acb->rqbuf_lastindex - 1; if(my_empty_len >= prbuffer->data_len) { if(arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0) acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW;