u64 current_cq_counter;
 
        /* Validate ts_offset not exceeding last max */
-       if (requested_offset_record > cb_last) {
+       if (requested_offset_record >= cb_last) {
                dev_err(buf->mmg->dev, "Ts offset exceeds max CB offset(0x%llx)\n",
                                                                (u64)(uintptr_t)cb_last);
                return -EINVAL;
                goto put_ctx;
        }
 
+       /* Validate the cq offset */
+       if (((u64 *) cq_cb->kernel_address + cq_counters_offset) >=
+                       ((u64 *) cq_cb->kernel_address + (cq_cb->size / sizeof(u64)))) {
+               rc = -EINVAL;
+               goto put_cq_cb;
+       }
+
        if (register_ts_record) {
                dev_dbg(hdev->dev, "Timestamp registration: interrupt id: %u, ts offset: %llu, cq_offset: %llu\n",
                                        interrupt->interrupt_id, ts_offset, cq_counters_offset);