mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
klondike - ensure all memcpy use the size of the target
This commit is contained in:
parent
fe5da96727
commit
c52973a96e
@ -464,7 +464,9 @@ static bool klondike_get_stats(struct cgpu_info *klncgpu)
|
|||||||
kitem = SendCmdGetReply(klncgpu, &kline, 0);
|
kitem = SendCmdGetReply(klncgpu, &kline, 0);
|
||||||
if (kitem != NULL) {
|
if (kitem != NULL) {
|
||||||
wr_lock(&(klninfo->stat_lock));
|
wr_lock(&(klninfo->stat_lock));
|
||||||
memcpy((void *)(&(klninfo->status[dev])), (void *)kitem, sizeof(*kitem));
|
memcpy((void *)(&(klninfo->status[dev])),
|
||||||
|
(void *)kitem,
|
||||||
|
sizeof(klninfo->status[dev]));
|
||||||
wr_unlock(&(klninfo->stat_lock));
|
wr_unlock(&(klninfo->stat_lock));
|
||||||
release_kitem(klncgpu, kitem);
|
release_kitem(klncgpu, kitem);
|
||||||
kitem = NULL;
|
kitem = NULL;
|
||||||
@ -533,7 +535,7 @@ static bool klondike_init(struct cgpu_info *klncgpu)
|
|||||||
kline.cfg.dev = dev;
|
kline.cfg.dev = dev;
|
||||||
kitem = SendCmdGetReply(klncgpu, &kline, size);
|
kitem = SendCmdGetReply(klncgpu, &kline, size);
|
||||||
if (kitem != NULL) {
|
if (kitem != NULL) {
|
||||||
memcpy((void *)&(klninfo->cfg[dev]), kitem, sizeof(*kitem));
|
memcpy((void *)&(klninfo->cfg[dev]), kitem, sizeof(klninfo->cfg[dev]));
|
||||||
applog(LOG_WARNING, "Klondike config (%d: Clk: %d, T:%.0lf, C:%.0lf, F:%d)",
|
applog(LOG_WARNING, "Klondike config (%d: Clk: %d, T:%.0lf, C:%.0lf, F:%d)",
|
||||||
dev, K_HASHCLOCK(klninfo->cfg[dev].kline.cfg.hashclock),
|
dev, K_HASHCLOCK(klninfo->cfg[dev].kline.cfg.hashclock),
|
||||||
cvtKlnToC(klninfo->cfg[dev].kline.cfg.temptarget),
|
cvtKlnToC(klninfo->cfg[dev].kline.cfg.temptarget),
|
||||||
@ -810,7 +812,9 @@ static void klondike_flush_work(struct cgpu_info *klncgpu)
|
|||||||
kitem = SendCmdGetReply(klncgpu, &kline, KSENDHD(0));
|
kitem = SendCmdGetReply(klncgpu, &kline, KSENDHD(0));
|
||||||
if (kitem != NULL) {
|
if (kitem != NULL) {
|
||||||
wr_lock(&(klninfo->stat_lock));
|
wr_lock(&(klninfo->stat_lock));
|
||||||
memcpy((void *)&(klninfo->status[dev]), kitem, sizeof(*kitem));
|
memcpy((void *)&(klninfo->status[dev]),
|
||||||
|
kitem,
|
||||||
|
sizeof(klninfo->status[dev]));
|
||||||
wr_unlock(&(klninfo->stat_lock));
|
wr_unlock(&(klninfo->stat_lock));
|
||||||
release_kitem(klncgpu, kitem);
|
release_kitem(klncgpu, kitem);
|
||||||
kitem = NULL;
|
kitem = NULL;
|
||||||
@ -911,7 +915,7 @@ static bool klondike_send_work(struct cgpu_info *klncgpu, int dev, struct work *
|
|||||||
KLIST *kitem = SendCmdGetReply(klncgpu, &kline, sizeof(kline.wt));
|
KLIST *kitem = SendCmdGetReply(klncgpu, &kline, sizeof(kline.wt));
|
||||||
if (kitem != NULL) {
|
if (kitem != NULL) {
|
||||||
wr_lock(&(klninfo->stat_lock));
|
wr_lock(&(klninfo->stat_lock));
|
||||||
memcpy((void *)&(klninfo->status[dev]), kitem, sizeof(*kitem));
|
memcpy((void *)&(klninfo->status[dev]), kitem, sizeof(klninfo->status[dev]));
|
||||||
wr_unlock(&(klninfo->stat_lock));
|
wr_unlock(&(klninfo->stat_lock));
|
||||||
release_kitem(klncgpu, kitem);
|
release_kitem(klncgpu, kitem);
|
||||||
kitem = NULL;
|
kitem = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user